MCPcopy Index your code
hub / github.com/go-dev-frame/sponge / TestGetPostgresqlTableInfo

Function TestGetPostgresqlTableInfo

pkg/sql2code/parser/parser_test.go:347–363  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

345}
346
347func TestGetPostgresqlTableInfo(t *testing.T) {
348 var (
349 dbname = "account"
350 tableName = "user_order"
351 dsn = fmt.Sprintf("host=192.168.3.37 port=5432 user=root password=123456 dbname=%s sslmode=disable", dbname)
352 )
353
354 fields, err := GetPostgresqlTableInfo(dsn, tableName)
355 if err != nil {
356 t.Log(err)
357 return
358 }
359 printPGFields(fields)
360 sql, fieldTypes := ConvertToSQLByPgFields(tableName, fields)
361 t.Log(sql)
362 t.Log(fieldTypes)
363}
364
365func Test_getPostgresqlTableFields(t *testing.T) {
366 defer func() { _ = recover() }()

Callers

nothing calls this directly

Calls 3

GetPostgresqlTableInfoFunction · 0.85
printPGFieldsFunction · 0.85
ConvertToSQLByPgFieldsFunction · 0.85

Tested by

no test coverage detected