Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/apollo/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
#APOLLO_PORTAL_DB_PASSWORD: 'apollo'

apollo-db:
image: "loads/mysql:5.7"
image: "mysql:5.7"
container_name: apollo-db
environment:
TZ: Asia/Shanghai
Expand All @@ -36,7 +36,7 @@ services:
- apollo-dbdata

apollo-dbdata:
image: "loads/alpine:3.8"
image: "alpine:3.8"
container_name: apollo-dbdata
volumes:
- /var/lib/mysql
18 changes: 9 additions & 9 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ jobs:
# Service containers to run with `code-test`
services:
# Etcd service.
# docker run -d --name etcd -p 2379:2379 -e ALLOW_NONE_AUTHENTICATION=yes loads/etcd:3.4.24
# docker run -d --name etcd -p 2379:2379 -e ALLOW_NONE_AUTHENTICATION=yes bitnami/etcd:3.4.24
etcd:
image: loads/etcd:3.4.24
image: bitnami/etcd:3.4.24
env:
ALLOW_NONE_AUTHENTICATION: yes
ports:
- 2379:2379

# Redis backend server.
redis:
image : loads/redis:7.0
image : redis:7.0
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
Expand All @@ -62,9 +62,9 @@ jobs:
# -p 3306:3306 \
# -e MYSQL_DATABASE=test \
# -e MYSQL_ROOT_PASSWORD=12345678 \
# loads/mysql:5.7
# mysql:5.7
mysql:
image: loads/mysql:5.7
image: mysql:5.7
env:
MYSQL_DATABASE : test
MYSQL_ROOT_PASSWORD: 12345678
Expand All @@ -73,7 +73,7 @@ jobs:

# MariaDb backend server.
mariadb:
image: loads/mariadb:10.4
image: mariadb:10.4
env:
MARIADB_DATABASE: test
MARIADB_ROOT_PASSWORD: 12345678
Expand All @@ -87,9 +87,9 @@ jobs:
# -e POSTGRES_USER=postgres \
# -e POSTGRES_DB=test \
# -v postgres:/Users/john/Temp/postgresql/data \
# loads/postgres:13
# postgres:17-alpine
postgres:
image: loads/postgres:13
image: postgres:17-alpine
env:
POSTGRES_PASSWORD: 12345678
POSTGRES_USER: postgres
Expand Down Expand Up @@ -184,7 +184,7 @@ jobs:
- 5236:5236

zookeeper:
image: loads/zookeeper:3.8
image: zookeeper:3.8
ports:
- 2181:2181

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nacos/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.8"

services:
nacos:
image: loads/nacos-server:v2.1.2
image: nacos/nacos-server:v2.1.2
container_name: nacos
env_file:
- ./env/nacos.env
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ example/log
go.work
go.work.sum
!cmd/gf/go.work
.windsurfrules

# Ignore for docs
node_modules
Expand Down
34 changes: 34 additions & 0 deletions contrib/drivers/pgsql/pgsql_z_unit_issue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,37 @@ func Test_Issue3668(t *testing.T) {
t.AssertNil(err)
})
}

type Issue4033Status int

const (
Issue4033StatusA Issue4033Status = 1
)

func (s Issue4033Status) String() string {
return "somevalue"
}

func (s Issue4033Status) Int64() int64 {
return int64(s)
}

// https://github.com/gogf/gf/issues/4033
func Test_Issue4033(t *testing.T) {
var (
sqlText = gtest.DataContent("issues", "issue4033.sql")
table = "test_enum"
)
if _, err := db.Exec(ctx, sqlText); err != nil {
gtest.Fatal(err)
}
defer dropTable(table)

gtest.C(t, func(t *gtest.T) {
query := g.Map{
"status": g.Slice{Issue4033StatusA},
}
_, err := db.Model(table).Ctx(ctx).Where(query).All()
t.AssertNil(err)
})
}
5 changes: 5 additions & 0 deletions contrib/drivers/pgsql/testdata/issues/issue4033.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE TABLE test_enum (
id int8 NOT NULL,
status int2 DEFAULT 0 NOT NULL,
CONSTRAINT test_enum_pk PRIMARY KEY (id)
);
8 changes: 4 additions & 4 deletions contrib/registry/consul/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/armon/go-metrics v0.4.1 // indirect
github.com/clbanning/mxj/v2 v2.7.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
Expand All @@ -24,7 +24,7 @@ require (
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/serf v0.10.1 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/magiconair/properties v1.8.9 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
Expand All @@ -34,8 +34,8 @@ require (
go.opentelemetry.io/otel/sdk v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down
4 changes: 4 additions & 0 deletions contrib/registry/consul/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
Expand Down Expand Up @@ -105,6 +106,7 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/magiconair/properties v1.8.9/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
Expand Down Expand Up @@ -222,13 +224,15 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
33 changes: 20 additions & 13 deletions database/gdb/gdb_func.go
Original file line number Diff line number Diff line change
Expand Up @@ -856,20 +856,9 @@ func handleSliceAndStructArgsForSql(
return s
})

default:
// Special struct handling.
case reflect.Struct:
switch oldArg.(type) {
// Do not append Raw arg to args but directly into the sql.
case Raw, *Raw:
var counter = 0
newSql = gstr.ReplaceFunc(newSql, `?`, func(s string) string {
counter++
if counter == index+insertHolderCount+1 {
return gconv.String(oldArg)
}
return s
})
continue

// The underlying driver supports time.Time/*time.Time types.
case time.Time, *time.Time:
newArgs = append(newArgs, oldArg)
Expand All @@ -892,6 +881,24 @@ func handleSliceAndStructArgsForSql(
}
}
newArgs = append(newArgs, oldArg)

default:
switch oldArg.(type) {
// Do not append Raw arg to args but directly into the sql.
case Raw, *Raw:
var counter = 0
newSql = gstr.ReplaceFunc(newSql, `?`, func(s string) string {
counter++
if counter == index+insertHolderCount+1 {
return gconv.String(oldArg)
}
return s
})
continue

default:
}
newArgs = append(newArgs, oldArg)
}
}
return
Expand Down
Loading