Compare commits
6 Commits
geoip/v1.0
...
v1.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8a6f7f7d8 | ||
|
|
149ded5d4e | ||
|
|
60c0477999 | ||
|
|
ef3aa38cb2 | ||
|
|
498bc3ea18 | ||
|
|
1c225465de |
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/mattn/go-sqlite3"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
|
||||
"github.com/tx7do/kratos-utils/bank_card/assets"
|
||||
"github.com/tx7do/go-utils/bank_card/assets"
|
||||
)
|
||||
|
||||
type Database struct {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module github.com/tx7do/kratos-utils/bank_card
|
||||
module github.com/tx7do/go-utils/bank_card
|
||||
|
||||
go 1.20
|
||||
|
||||
@@ -12,3 +12,5 @@ require (
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
replace github.com/tx7do/go-utils => ../
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module github.com/tx7do/kratos-utils/entgo
|
||||
module github.com/tx7do/go-utils/entgo
|
||||
|
||||
go 1.20
|
||||
|
||||
@@ -8,7 +8,7 @@ require (
|
||||
github.com/go-kratos/kratos/v2 v2.7.1
|
||||
github.com/google/uuid v1.3.1
|
||||
github.com/stretchr/testify v1.8.4
|
||||
github.com/tx7do/kratos-utils v0.0.0-20231025044346-36a096df76d8
|
||||
github.com/tx7do/go-utils v1.1.0
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -34,3 +34,5 @@ require (
|
||||
google.golang.org/protobuf v1.31.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
replace github.com/tx7do/go-utils => ../
|
||||
|
||||
@@ -44,8 +44,6 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR
|
||||
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/tx7do/kratos-utils v0.0.0-20231025044346-36a096df76d8 h1:G+s0DQ6zI0dGcvd9tRpXcYzelO0xRnp2jpFtQ+697Ko=
|
||||
github.com/tx7do/kratos-utils v0.0.0-20231025044346-36a096df76d8/go.mod h1:rTeeqeABjK9HamIwKZ+uLozVIk/hGiEbNsi6rVr4l0w=
|
||||
github.com/zclconf/go-cty v1.14.1 h1:t9fyA35fwjjUMcmL5hLER+e/rEPqrbCK1/OSE4SI9KA=
|
||||
github.com/zclconf/go-cty v1.14.1/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
|
||||
@@ -69,11 +69,11 @@ func (TimeAt) Fields() []ent.Field {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var _ ent.Mixin = (*CreatedTime)(nil)
|
||||
var _ ent.Mixin = (*CreateTime)(nil)
|
||||
|
||||
type CreatedTime struct{ mixin.Schema }
|
||||
type CreateTime struct{ mixin.Schema }
|
||||
|
||||
func (CreatedTime) Fields() []ent.Field {
|
||||
func (CreateTime) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
// 创建时间
|
||||
field.Time("create_time").
|
||||
@@ -86,11 +86,11 @@ func (CreatedTime) Fields() []ent.Field {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var _ ent.Mixin = (*UpdatedTime)(nil)
|
||||
var _ ent.Mixin = (*UpdateTime)(nil)
|
||||
|
||||
type UpdatedTime struct{ mixin.Schema }
|
||||
type UpdateTime struct{ mixin.Schema }
|
||||
|
||||
func (UpdatedTime) Fields() []ent.Field {
|
||||
func (UpdateTime) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
// 更新时间
|
||||
field.Time("update_time").
|
||||
@@ -102,11 +102,11 @@ func (UpdatedTime) Fields() []ent.Field {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var _ ent.Mixin = (*DeletedTime)(nil)
|
||||
var _ ent.Mixin = (*DeleteTime)(nil)
|
||||
|
||||
type DeletedTime struct{ mixin.Schema }
|
||||
type DeleteTime struct{ mixin.Schema }
|
||||
|
||||
func (DeletedTime) Fields() []ent.Field {
|
||||
func (DeleteTime) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
// 删除时间
|
||||
field.Time("delete_time").
|
||||
@@ -122,9 +122,9 @@ type Time struct{ mixin.Schema }
|
||||
|
||||
func (Time) Fields() []ent.Field {
|
||||
var fields []ent.Field
|
||||
fields = append(fields, CreatedTime{}.Fields()...)
|
||||
fields = append(fields, UpdatedTime{}.Fields()...)
|
||||
fields = append(fields, DeletedTime{}.Fields()...)
|
||||
fields = append(fields, CreateTime{}.Fields()...)
|
||||
fields = append(fields, UpdateTime{}.Fields()...)
|
||||
fields = append(fields, DeleteTime{}.Fields()...)
|
||||
return fields
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package mixin
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/mixin"
|
||||
"time"
|
||||
)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -74,3 +75,71 @@ func (Timestamp) Fields() []ent.Field {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var _ ent.Mixin = (*CreatedAtTimestamp)(nil)
|
||||
|
||||
type CreatedAtTimestamp struct{ mixin.Schema }
|
||||
|
||||
func (CreatedAtTimestamp) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
// 创建时间,毫秒
|
||||
field.Int64("created_at").
|
||||
Comment("创建时间").
|
||||
Immutable().
|
||||
Optional().
|
||||
Nillable().
|
||||
DefaultFunc(time.Now().UnixMilli),
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var _ ent.Mixin = (*UpdatedAtTimestamp)(nil)
|
||||
|
||||
type UpdatedAtTimestamp struct{ mixin.Schema }
|
||||
|
||||
func (UpdatedAtTimestamp) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
// 更新时间,毫秒
|
||||
// 需要注意的是,如果不是程序自动更新,那么这个字段不会被更新,除非在数据库里面下触发器更新。
|
||||
field.Int64("updated_at").
|
||||
Comment("更新时间").
|
||||
Optional().
|
||||
Nillable().
|
||||
UpdateDefault(time.Now().UnixMilli),
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var _ ent.Mixin = (*DeletedAtTimestamp)(nil)
|
||||
|
||||
type DeletedAtTimestamp struct{ mixin.Schema }
|
||||
|
||||
func (DeletedAtTimestamp) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
// 删除时间,毫秒
|
||||
field.Int64("deleted_at").
|
||||
Comment("删除时间").
|
||||
Optional().
|
||||
Nillable(),
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var _ ent.Mixin = (*TimestampAt)(nil)
|
||||
|
||||
type TimestampAt struct{ mixin.Schema }
|
||||
|
||||
func (TimestampAt) Fields() []ent.Field {
|
||||
var fields []ent.Field
|
||||
fields = append(fields, CreatedAtTimestamp{}.Fields()...)
|
||||
fields = append(fields, UpdatedAtTimestamp{}.Fields()...)
|
||||
fields = append(fields, DeletedAtTimestamp{}.Fields()...)
|
||||
return fields
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"github.com/go-kratos/kratos/v2/encoding"
|
||||
|
||||
"github.com/tx7do/kratos-utils/stringcase"
|
||||
"github.com/tx7do/go-utils/stringcase"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -3,7 +3,7 @@ package entgo
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
|
||||
paging "github.com/tx7do/kratos-utils/pagination"
|
||||
paging "github.com/tx7do/go-utils/pagination"
|
||||
)
|
||||
|
||||
func BuildPaginationSelector(page, pageSize int32, noPaging bool) func(*sql.Selector) {
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"github.com/oschwald/geoip2-golang"
|
||||
|
||||
"github.com/tx7do/kratos-utils/geoip"
|
||||
"github.com/tx7do/kratos-utils/geoip/geolite/assets"
|
||||
"github.com/tx7do/go-utils/geoip"
|
||||
"github.com/tx7do/go-utils/geoip/geolite/assets"
|
||||
)
|
||||
|
||||
const defaultOutputLanguage = "zh-CN"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module github.com/tx7do/kratos-utils/geoip
|
||||
module github.com/tx7do/go-utils/geoip
|
||||
|
||||
go 1.20
|
||||
|
||||
@@ -17,3 +17,5 @@ require (
|
||||
golang.org/x/sys v0.10.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
replace github.com/tx7do/go-utils => ../
|
||||
|
||||
@@ -3,12 +3,12 @@ package qqwry
|
||||
import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"github.com/tx7do/kratos-utils/geoip"
|
||||
"github.com/tx7do/go-utils/geoip"
|
||||
"net"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/tx7do/kratos-utils/geoip/qqwry/assets"
|
||||
"github.com/tx7do/go-utils/geoip/qqwry/assets"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
|
||||
36
gitautotag.sh
Normal file
36
gitautotag.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
CURTAG=`git describe --abbrev=0 --tags`;
|
||||
CURTAG="${CURTAG/v/}"
|
||||
|
||||
IFS='.' read -a vers <<< "$CURTAG"
|
||||
|
||||
MAJ=${vers[0]}
|
||||
MIN=${vers[1]}
|
||||
BUG=${vers[2]}
|
||||
echo "Current Tag: v$MAJ.$MIN.$BUG"
|
||||
|
||||
for cmd in "$@"
|
||||
do
|
||||
case $cmd in
|
||||
"--major")
|
||||
# $((MAJ+1))
|
||||
((MAJ+=1))
|
||||
MIN=0
|
||||
BUG=0
|
||||
echo "Incrementing Major Version#"
|
||||
;;
|
||||
"--minor")
|
||||
((MIN+=1))
|
||||
BUG=0
|
||||
echo "Incrementing Minor Version#"
|
||||
;;
|
||||
"--bug")
|
||||
((BUG+=1))
|
||||
echo "Incrementing Bug Version#"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
NEWTAG="v$MAJ.$MIN.$BUG"
|
||||
echo "Adding Tag: $NEWTAG";
|
||||
git tag -a $NEWTAG -m $NEWTAG
|
||||
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
||||
module github.com/tx7do/kratos-utils
|
||||
module github.com/tx7do/go-utils
|
||||
|
||||
go 1.20
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/tx7do/kratos-utils/trans"
|
||||
"github.com/tx7do/go-utils/trans"
|
||||
)
|
||||
|
||||
type idCounter uint32
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/tx7do/kratos-utils/trans"
|
||||
"github.com/tx7do/go-utils/trans"
|
||||
)
|
||||
|
||||
func TestGenerateOrderIdWithRandom(t *testing.T) {
|
||||
|
||||
6
tag.bat
Normal file
6
tag.bat
Normal file
@@ -0,0 +1,6 @@
|
||||
git tag v1.1.0
|
||||
git tag bank_card/v1.1.0
|
||||
git tag entgo/v1.1.0
|
||||
git tag geoip/v1.1.0
|
||||
|
||||
git push origin --tags
|
||||
@@ -3,7 +3,7 @@ package util
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/tx7do/kratos-utils/trans"
|
||||
"github.com/tx7do/go-utils/trans"
|
||||
)
|
||||
|
||||
var DefaultTimeLocation *time.Location
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/tx7do/kratos-utils/trans"
|
||||
"github.com/tx7do/go-utils/trans"
|
||||
)
|
||||
|
||||
func TestUnixMilliToStringPtr(t *testing.T) {
|
||||
|
||||
19
upgrade.bat
Normal file
19
upgrade.bat
Normal file
@@ -0,0 +1,19 @@
|
||||
echo off
|
||||
|
||||
::指定起始文件夹
|
||||
set DIR="%cd%"
|
||||
|
||||
go get all
|
||||
go mod tidy
|
||||
|
||||
cd %DIR%/bank_card
|
||||
go get all
|
||||
go mod tidy
|
||||
|
||||
cd %DIR%/entgo
|
||||
go get all
|
||||
go mod tidy
|
||||
|
||||
cd %DIR%/geoip
|
||||
go get all
|
||||
go mod tidy
|
||||
Reference in New Issue
Block a user