Documentation ¶
Index ¶
- Constants
- func NewHttpRequest(r *request) *http.Request
- func Ping(ctx context.Context) *runtime.Status
- func Query(ctx context.Context, h http.Header, resource, template string, ...) (rows pgx.Rows, status *runtime.Status)
- func Readiness() *runtime.Status
- func Scan[T Scanner[T]](rows pgx.Rows) ([]T, *runtime.Status)
- func Stat(ctx context.Context) (*pgxpool.Stat, *runtime.Status)
- type Attr
- type CommandTag
- func Delete(ctx context.Context, h http.Header, resource, template string, where []Attr, ...) (tag CommandTag, status *runtime.Status)
- func Insert(ctx context.Context, h http.Header, resource, template string, values [][]any, ...) (tag CommandTag, status *runtime.Status)
- func Update(ctx context.Context, h http.Header, resource, template string, where []Attr, ...) (tag CommandTag, status *runtime.Status)
- type Scanner
Examples ¶
Constants ¶
View Source
const ( PingUri = postgresNID + ":" + pingNSS StatUri = postgresNID + ":" + statNSS )
View Source
const (
PkgPath = "github/advanced-go/postgresql/pgxsql"
)
Variables ¶
This section is empty.
Functions ¶
func NewHttpRequest ¶
func Ping ¶
Ping - ping the database cluster
Example ¶
err := testStartup() if err != nil { fmt.Printf("test: testStartup() -> [error:%v]\n", err) } else { defer clientShutdown() fmt.Printf("test: clientStartup() -> [started:%v]\n", isReady()) status := ping(nil) fmt.Printf("test: Ping(nil) -> %v\n", status) }
Output: test: clientStartup() -> [started:true] test: Ping(nil) -> OK
func Query ¶
func Query(ctx context.Context, h http.Header, resource, template string, values map[string][]string, args ...any) (rows pgx.Rows, status *runtime.Status)
Query - process a SQL select statement
func Stat ¶
Stat - retrieve runtime stats
Example ¶
err := testStartup() if err != nil { fmt.Printf("test: testStartup() -> [error:%v]\n", err) } else { defer clientShutdown() fmt.Printf("test: clientStartup() -> [started:%v]\n", isReady()) stat1, status := stat(nil) fmt.Printf("test: Stat(nil) -> [status:%v] [stat:%v]\n", status, stat1 != nil) }
Output: test: clientStartup() -> [started:true] test: Stat(nil) -> [status:OK] [stat:true]
Types ¶
type CommandTag ¶
type CommandTag struct { Sql string `json:"sql"` RowsAffected int64 `json:"rows-affected"` Insert bool `json:"insert"` Update bool `json:"update"` Delete bool `json:"delete"` Select bool `json:"select"` }
CommandTag - results from an Exec command
func Delete ¶
func Delete(ctx context.Context, h http.Header, resource, template string, where []Attr, args ...any) (tag CommandTag, status *runtime.Status)
Delete - execute a SQL delete statement
Click to show internal directories.
Click to hide internal directories.