request

package
v0.0.0-...-58f07da Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2025 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const (
	AgentName = "common:sql:agent/request/postgres"

	StatusTxnBeginError    = int(102) // Transaction processing begin error
	StatusTxnRollbackError = int(103) // Transaction processing rollback error
	StatusTxnCommitError   = int(104) // Transaction processing commit error
	StatusExecError        = int(105) // Execution error, as in a database call
	StatusNotStarted       = int(98)  // Not started
)

Variables

View Source
var Requester = func() *Interface {
	return &Interface{
		Execute: func(ctx context.Context, name, sql string, args ...any) (Result, error) {
			if ctx == nil {
				ctx = context.Background()
			}
			start := time.Now().UTC()
			tag, err := agent.exec(ctx, sql, args)
			agent.log(start, time.Since(start), routeName, newExecRequest(name), newResponse(agent.statusCode(err)), ctx)
			return tag, err
		},
	}
}()

Requester -

Functions

func NewAgent

func NewAgent() messaging.Agent
Example
a := newAgent()

fmt.Printf("test: newAgent() -> [%v]\n", a)
Output:
test: newAgent() -> [common:sql:agent/request/postgres]

Types

type Interface

type Interface struct {
	Execute func(ctx context.Context, name, sql string, args ...any) (Result, error)
}

Interface - TODO : determine if a bulk insert is needed

type Result

type Result 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"`
}

Result - results of a command

type Stat

type Stat struct {
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL