Compare commits
3 Commits
entgo/v1.1
...
entgo/v1.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d549d305ae | ||
|
|
23dcad60a3 | ||
|
|
fa7ae4f876 |
@@ -588,7 +588,7 @@ func filterJsonbField(s *sql.Selector, jsonbField, field string) string {
|
|||||||
p := sql.P()
|
p := sql.P()
|
||||||
switch s.Builder.Dialect() {
|
switch s.Builder.Dialect() {
|
||||||
case dialect.Postgres:
|
case dialect.Postgres:
|
||||||
p.Ident(s.C(field)).WriteString(" -> ").WriteString(jsonbField)
|
p.Ident(s.C(field)).WriteString(" ->> ").WriteString("'" + jsonbField + "'")
|
||||||
//b.Arg(strings.ToLower(value))
|
//b.Arg(strings.ToLower(value))
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|||||||
2
tag.bat
2
tag.bat
@@ -3,7 +3,7 @@ git tag v1.1.13
|
|||||||
git tag bank_card/v1.1.3
|
git tag bank_card/v1.1.3
|
||||||
git tag geoip/v1.1.3
|
git tag geoip/v1.1.3
|
||||||
|
|
||||||
git tag entgo/v1.1.18
|
git tag entgo/v1.1.19
|
||||||
git tag gorm/v1.1.3
|
git tag gorm/v1.1.3
|
||||||
|
|
||||||
git push origin --tags
|
git push origin --tags
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package util
|
package timeutil
|
||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package util
|
package timeutil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math"
|
"math"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package util
|
package timeutil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package util
|
package timeutil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package util
|
package timeutil
|
||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package util
|
package timeutil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package util
|
package timeutil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"google.golang.org/protobuf/types/known/durationpb"
|
||||||
"google.golang.org/protobuf/types/known/timestamppb"
|
"google.golang.org/protobuf/types/known/timestamppb"
|
||||||
|
|
||||||
"github.com/tx7do/go-utils/trans"
|
"github.com/tx7do/go-utils/trans"
|
||||||
@@ -132,3 +133,19 @@ func TimeToTimestamppb(tm *time.Time) *timestamppb.Timestamp {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func FloatToDurationpb(duration *float64, timePrecision time.Duration) *durationpb.Duration {
|
||||||
|
if duration == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return durationpb.New(time.Duration(*duration) * timePrecision)
|
||||||
|
}
|
||||||
|
|
||||||
|
func DurationpbToFloat(duration *durationpb.Duration, timePrecision time.Duration) *float64 {
|
||||||
|
if duration == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
seconds := duration.AsDuration().Seconds()
|
||||||
|
secondsWithPrecision := seconds / timePrecision.Seconds()
|
||||||
|
return &secondsWithPrecision
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package util
|
package timeutil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|||||||
Reference in New Issue
Block a user