Skip to content

Commit 65aa92c

Browse files
author
bing.ma
committed
remove or change all keywords
1 parent b261325 commit 65aa92c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+245
-260
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
)
2828

2929
func main() {
30-
conn, err := pgx.Connect(context.Background(), os.Getenv("DATABASE_URL"))
30+
conn, err := gaussdbgo.Connect(context.Background(), os.Getenv("DATABASE_URL"))
3131
if err != nil {
3232
log.Fatal(err)
3333
}
@@ -47,8 +47,8 @@ A clear and concise description of what actually happened.
4747

4848
**Version**
4949
- Go: `$ go version` -> [e.g. go version go1.18.3 darwin/amd64]
50-
- PostgreSQL: `$ psql --no-psqlrc --tuples-only -c 'select version()'` -> [e.g. PostgreSQL 14.4 on x86_64-apple-darwin21.5.0, compiled by Apple clang version 13.1.6 (clang-1316.0.21.2.5), 64-bit]
51-
- pgx: `$ grep 'github.com/jackc/pgx/v[0-9]' go.mod` -> [e.g. v4.16.1]
50+
- GaussDB: `$ gsql --no-psqlrc --tuples-only -c 'select version()'` -> [e.g. GaussDB 9.2.4 on x86_64-apple-darwin21.5.0, compiled by Apple clang version 13.1.6 (clang-1316.0.21.2.5), 64-bit]
51+
- gaussdbgo: `$ grep 'github.com/HuaweiCloudDeveloper/gaussdb-go/v[0-9]' go.mod` -> [e.g. v4.16.1]
5252

5353
**Additional context**
5454
Add any other context about the problem here.

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ jobs:
128128
go-version: ["1.22", "1.23"]
129129

130130
steps:
131-
- name: Setup PostgreSQL
132-
id: postgres
131+
- name: Setup GaussDB
132+
id: gaussdb
133133
uses: ikalnytskyi/action-setup-postgres@v4
134134
with:
135135
database: pgx_test

Rakefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ rule '.go' => '.go.erb' do |task|
77
end
88

99
generated_code_files = [
10-
"pgtype/int.go",
11-
"pgtype/int_test.go",
12-
"pgtype/integration_benchmark_test.go",
13-
"pgtype/zeronull/int.go",
14-
"pgtype/zeronull/int_test.go"
10+
"gaussdbtype/int.go",
11+
"gaussdbtype/int_test.go",
12+
"gaussdbtype/integration_benchmark_test.go",
13+
"gaussdbtype/zeronull/int.go",
14+
"gaussdbtype/zeronull/int_test.go"
1515
]
1616

1717
desc "Generate code"

batch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ type Batch struct {
6060
QueuedQueries []*QueuedQuery
6161
}
6262

63-
// Queue queues a query to batch b. query can be an SQL query or the name of a prepared statement. The only pgx option
63+
// Queue queues a query to batch b. query can be an SQL query or the name of a prepared statement. The only gaussdbgo option
6464
// argument that is supported is QueryRewriter. Queries are executed using the connection's DefaultQueryExecMode.
6565
//
6666
// While query can contain multiple statements if the connection's DefaultQueryExecMode is QueryModeSimple, this should

batch_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ func TestTxSendBatch(t *testing.T) {
767767
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
768768
defer cancel()
769769
770-
pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *gaussdbgo.Conn) {
770+
gaussdbxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *gaussdbgo.Conn) {
771771
772772
sql := `create temporary table ledger1(
773773
id serial primary key,

bench_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,7 @@ func (qr *queryRecorder) SetWriteDeadline(t time.Time) error {
13141314
return qr.conn.SetWriteDeadline(t)
13151315
}
13161316

1317-
// BenchmarkSelectRowsRawPrepared hijacks a pgconn connection and inserts a queryRecorder. It then executes the query
1317+
// BenchmarkSelectRowsRawPrepared hijacks a gaussdbconn connection and inserts a queryRecorder. It then executes the query
13181318
// once. The benchmark is simply sending the exact query bytes over the wire to the server and reading the expected
13191319
// number of bytes back. It does nothing else. This should be the theoretical maximum performance a Go application
13201320
// could achieve.

conn.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type ConnConfig struct {
3535
// "cache_describe" query exec mode.
3636
DescriptionCacheCapacity int
3737

38-
// DefaultQueryExecMode controls the default mode for executing queries. By default pgx uses the extended protocol
38+
// DefaultQueryExecMode controls the default mode for executing queries. By default gaussdbgo uses the extended protocol
3939
// and automatically prepares and caches prepared statements. However, this may be incompatible with proxies such as
4040
// PGBouncer. In this case it may be preferable to use QueryExecModeExec or QueryExecModeSimpleProtocol. The same
4141
// functionality can be controlled on a per query basis by passing a QueryExecMode as the first query argument.
@@ -59,7 +59,7 @@ func (cc *ConnConfig) Copy() *ConnConfig {
5959
return newConfig
6060
}
6161

62-
// ConnString returns the connection string as parsed by pgx.ParseConfig into pgx.ConnConfig.
62+
// ConnString returns the connection string as parsed by gaussdbgo.ParseConfig into gaussdbgo.ConnConfig.
6363
func (cc *ConnConfig) ConnString() string { return cc.connString }
6464

6565
// Conn is a GaussDB connection handle. It is not safe for concurrent usage. Use a connection pool to manage access
@@ -130,7 +130,7 @@ var (
130130
)
131131

132132
// Connect establishes a connection with a GaussDB server with a connection string. See
133-
// pgconn.Connect for details.
133+
// gaussdbconn.Connect for details.
134134
func Connect(ctx context.Context, connString string) (*Conn, error) {
135135
connConfig, err := ParseConfig(connString)
136136
if err != nil {
@@ -218,7 +218,7 @@ func ParseConfigWithOptions(connString string, options ParseConfigOptions) (*Con
218218
return connConfig, nil
219219
}
220220

221-
// ParseConfig creates a ConnConfig from a connection string. ParseConfig handles all options that [pgconn.ParseConfig]
221+
// ParseConfig creates a ConnConfig from a connection string. ParseConfig handles all options that [gaussdbconn.ParseConfig]
222222
// does. In addition, it accepts the following options:
223223
//
224224
// - default_query_exec_mode.
@@ -267,7 +267,7 @@ func connect(ctx context.Context, config *ConnConfig) (c *Conn, err error) {
267267
c.prepareTracer = t
268268
}
269269

270-
// Only install pgx notification system if no other callback handler is present.
270+
// Only install gaussdbgo notification system if no other callback handler is present.
271271
if config.Config.OnNotification == nil {
272272
config.Config.OnNotification = c.bufferNotifications
273273
}
@@ -395,7 +395,7 @@ func (c *Conn) bufferNotifications(_ *gaussdbconn.GaussdbConn, n *gaussdbconn.No
395395
c.notifications = append(c.notifications, n)
396396
}
397397

398-
// WaitForNotification waits for a GaussDB notification. It wraps the underlying pgconn notification system in a
398+
// WaitForNotification waits for a GaussDB notification. It wraps the underlying gaussdbconn notification system in a
399399
// slightly more convenient form.
400400
func (c *Conn) WaitForNotification(ctx context.Context) (*gaussdbconn.Notification, error) {
401401
var n *gaussdbconn.Notification
@@ -434,16 +434,16 @@ func quoteIdentifier(s string) string {
434434
return `"` + strings.ReplaceAll(s, `"`, `""`) + `"`
435435
}
436436

437-
// Ping delegates to the underlying *pgconn.GaussdbConn.Ping.
437+
// Ping delegates to the underlying *gaussdbconn.GaussdbConn.Ping.
438438
func (c *Conn) Ping(ctx context.Context) error {
439439
return c.gaussdbConn.Ping(ctx)
440440
}
441441

442-
// GaussdbConn returns the underlying *pgconn.GaussdbConn. This is an escape hatch method that allows lower level access to the
443-
// GaussDB connection than pgx exposes.
442+
// GaussdbConn returns the underlying *gaussdbconn.GaussdbConn. This is an escape hatch method that allows lower level access to the
443+
// GaussDB connection than gaussdbgo exposes.
444444
//
445-
// It is strongly recommended that the connection be idle (no in-progress queries) before the underlying *pgconn.GaussdbConn
446-
// is used and the connection must be returned to the same state before any *pgx.Conn methods are again used.
445+
// It is strongly recommended that the connection be idle (no in-progress queries) before the underlying *gaussdbconn.GaussdbConn
446+
// is used and the connection must be returned to the same state before any *gaussdbgo.Conn methods are again used.
447447
func (c *Conn) GaussdbConn() *gaussdbconn.GaussdbConn { return c.gaussdbConn }
448448

449449
// TypeMap returns the connection info used for this connection.
@@ -639,7 +639,7 @@ const (
639639

640640
// Assume the GaussDB query parameter types based on the Go type of the arguments. This uses the extended protocol
641641
// with text formatted parameters and results. Queries are executed in a single round trip. Type mappings can be
642-
// registered with pgtype.Map.RegisterDefaultGaussdbType. Queries will be rejected that have arguments that are
642+
// registered with gaussdbtype.Map.RegisterDefaultGaussdbType. Queries will be rejected that have arguments that are
643643
// unregistered or ambiguous. e.g. A map[string]string may have the GaussDB type json or hstore. Modes that know
644644
// the GaussDB type can use a map[string]string directly as an argument. This mode cannot.
645645
//
@@ -648,15 +648,15 @@ const (
648648
// Roman numerals (e.g. 7 is VII). The binary format would properly encode the integer 7 as the binary value for 7.
649649
// But the text format would encode the integer 7 as the string "VII". As QueryExecModeExec uses the text format, it
650650
// is possible that changing query mode from another mode to QueryExecModeExec could change the behavior of the query.
651-
// This should not occur with types pgx supports directly and can be avoided by registering the types with
652-
// pgtype.Map.RegisterDefaultGaussdbType and implementing the appropriate type interfaces. In the cas of RomanNumeral, it
653-
// should implement pgtype.Int64Valuer.
651+
// This should not occur with types gaussdbgo supports directly and can be avoided by registering the types with
652+
// gaussdbtype.Map.RegisterDefaultGaussdbType and implementing the appropriate type interfaces. In the cas of RomanNumeral, it
653+
// should implement gaussdbtype.Int64Valuer.
654654
QueryExecModeExec
655655

656656
// Use the simple protocol. Assume the GaussDB query parameter types based on the Go type of the arguments. This is
657657
// especially significant for []byte values. []byte values are encoded as GaussDB bytea. string must be used
658658
// instead for text type values including json and jsonb. Type mappings can be registered with
659-
// pgtype.Map.RegisterDefaultGaussdbType. Queries will be rejected that have arguments that are unregistered or ambiguous.
659+
// gaussdbtype.Map.RegisterDefaultGaussdbType. Queries will be rejected that have arguments that are unregistered or ambiguous.
660660
// e.g. A map[string]string may have the GaussDB type json or hstore. Modes that know the GaussDB type can use a
661661
// map[string]string directly as an argument. This mode cannot. Queries are executed in a single round trip.
662662
//
@@ -1243,8 +1243,8 @@ func (c *Conn) sanitizeForSimpleQuery(sql string, args ...any) (string, error) {
12431243
return sanitize.SanitizeSQL(sql, valueArgs...)
12441244
}
12451245

1246-
// LoadType inspects the database for typeName and produces a pgtype.Type suitable for registration. typeName must be
1247-
// the name of a type where the underlying type(s) is already understood by pgx. It is for derived types. In particular,
1246+
// LoadType inspects the database for typeName and produces a gaussdbtype.Type suitable for registration. typeName must be
1247+
// the name of a type where the underlying type(s) is already understood by gaussdbgo. It is for derived types. In particular,
12481248
// typeName must be one of the following:
12491249
// - An array type name of a type that is already registered. e.g. "_foo" when "foo" is registered.
12501250
// - A composite type name where all field types are already registered.

conn_test.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func TestConnectWithPreferSimpleProtocol(t *testing.T) {
8888
defer closeConn(t, conn)
8989

9090
// If simple protocol is used we should be able to correctly scan the result
91-
// into a pgtype.Text as the integer will have been encoded in text.
91+
// into a gaussdbtype.Text as the integer will have been encoded in text.
9292

9393
var s gaussdbtype.Text
9494
err := conn.QueryRow(context.Background(), "select $1::int4", 42).Scan(&s)
@@ -113,7 +113,7 @@ func TestConfigContainsConnStr(t *testing.T) {
113113
}
114114

115115
func TestConfigCopyReturnsEqualConfig(t *testing.T) {
116-
connString := "gaussdb://jack:secret@localhost:5432/mydb?application_name=pgxtest&search_path=myschema&connect_timeout=5"
116+
connString := "gaussdb://jack:secret@localhost:5432/mydb?application_name=gaussdbxtest&search_path=myschema&connect_timeout=5"
117117
original, err := gaussdbgo.ParseConfig(connString)
118118
require.NoError(t, err)
119119

@@ -652,7 +652,7 @@ func TestDeallocateMissingPreparedStatementStillClearsFromPreparedStatementMap(t
652652
ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond)
653653
defer cancel()
654654
notification, err = listener.WaitForNotification(ctx)
655-
assert.True(t, pgconn.Timeout(err))
655+
assert.True(t, gaussdbconn.Timeout(err))
656656
assert.Nil(t, notification)
657657
658658
// listener can listen again after a timeout
@@ -968,7 +968,7 @@ func TestConnInitTypeMap(t *testing.T) {
968968
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
969969
defer cancel()
970970
971-
pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *gaussdbgo.Conn) {
971+
gaussdbxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *gaussdbgo.Conn) {
972972
973973
// Domain type uint64 is a GaussDB domain of underlying type numeric.
974974
@@ -1103,7 +1103,7 @@ func TestLoadRangeType(t *testing.T) {
11031103
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
11041104
defer cancel()
11051105
1106-
pgxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *gaussdbgo.Conn) {
1106+
gaussdbxtest.RunWithQueryExecModes(ctx, t, defaultConnTestRunner, nil, func(ctx context.Context, t testing.TB, conn *gaussdbgo.Conn) {
11071107
11081108
tx, err := conn.Begin(ctx)
11091109
require.NoError(t, err)
@@ -1116,30 +1116,30 @@ func TestLoadRangeType(t *testing.T) {
11161116
newRangeType, err := conn.LoadType(ctx, "examplefloatrange")
11171117
require.NoError(t, err)
11181118
conn.TypeMap().RegisterType(newRangeType)
1119-
conn.TypeMap().RegisterDefaultGaussdbType(pgtype.Range[float64]{}, "examplefloatrange")
1119+
conn.TypeMap().RegisterDefaultGaussdbType(gaussdbtype.Range[float64]{}, "examplefloatrange")
11201120
11211121
newMultiRangeType, err := conn.LoadType(ctx, "examplefloatmultirange")
11221122
require.NoError(t, err)
11231123
conn.TypeMap().RegisterType(newMultiRangeType)
1124-
conn.TypeMap().RegisterDefaultGaussdbType(pgtype.Multirange[pgtype.Range[float64]]{}, "examplefloatmultirange")
1124+
conn.TypeMap().RegisterDefaultGaussdbType(gaussdbtype.Multirange[gaussdbtype.Range[float64]]{}, "examplefloatmultirange")
11251125
1126-
var inputMultiRangeType = pgtype.Multirange[pgtype.Range[float64]]{
1126+
var inputMultiRangeType = gaussdbtype.Multirange[gaussdbtype.Range[float64]]{
11271127
{
11281128
Lower: 1.0,
11291129
Upper: 2.0,
1130-
LowerType: pgtype.Inclusive,
1131-
UpperType: pgtype.Inclusive,
1130+
LowerType: gaussdbtype.Inclusive,
1131+
UpperType: gaussdbtype.Inclusive,
11321132
Valid: true,
11331133
},
11341134
{
11351135
Lower: 3.0,
11361136
Upper: 4.0,
1137-
LowerType: pgtype.Exclusive,
1138-
UpperType: pgtype.Exclusive,
1137+
LowerType: gaussdbtype.Exclusive,
1138+
UpperType: gaussdbtype.Exclusive,
11391139
Valid: true,
11401140
},
11411141
}
1142-
var outputMultiRangeType pgtype.Multirange[pgtype.Range[float64]]
1142+
var outputMultiRangeType gaussdbtype.Multirange[gaussdbtype.Range[float64]]
11431143
err = tx.QueryRow(ctx, "SELECT $1::examplefloatmultirange", inputMultiRangeType).Scan(&outputMultiRangeType)
11441144
require.NoError(t, err)
11451145
require.Equal(t, inputMultiRangeType, outputMultiRangeType)

copy_from.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,11 @@ func (ct *copyFrom) buildCopyBuf(buf []byte, sd *gaussdbconn.StatementDescriptio
257257
// CopyFrom uses the GaussDB copy protocol to perform bulk data insertion. It returns the number of rows copied and
258258
// an error.
259259
//
260-
// CopyFrom requires all values use the binary format. A pgtype.Type that supports the binary format must be registered
261-
// for the type of each column. Almost all types implemented by pgx support the binary format.
260+
// CopyFrom requires all values use the binary format. A gaussdbtype.Type that supports the binary format must be registered
261+
// for the type of each column. Almost all types implemented by gaussdbgo support the binary format.
262262
//
263263
// Even though enum types appear to be strings they still must be registered to use with CopyFrom. This can be done with
264-
// Conn.LoadType and pgtype.Map.RegisterType.
264+
// Conn.LoadType and gaussdbtype.Map.RegisterType.
265265
func (c *Conn) CopyFrom(ctx context.Context, tableName Identifier, columnNames []string, rowSrc CopyFromSource) (int64, error) {
266266
ct := &copyFrom{
267267
conn: c,

derived_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func (c *Conn) LoadTypes(ctx context.Context, typeNames []string) ([]*gaussdbtyp
186186
case "b": // array
187187
dt, ok := m.TypeForOID(ti.Typelem)
188188
if !ok {
189-
return nil, fmt.Errorf("Array element OID %v not registered while loading pgtype %q", ti.Typelem, ti.TypeName)
189+
return nil, fmt.Errorf("Array element OID %v not registered while loading gaussdbtype %q", ti.Typelem, ti.TypeName)
190190
}
191191
type_ = &gaussdbtype.Type{Name: ti.TypeName, OID: ti.Oid, Codec: &gaussdbtype.ArrayCodec{ElementType: dt}}
192192
case "c": // composite

0 commit comments

Comments
 (0)