Documentation ¶
Overview ¶
Package pgcall implements a caller of postgresql stored functions, which intended to use via http and in templates.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { InDefFunc string `long:"indef" default:"func_args" description:"Argument definition function"` OutDefFunc string `long:"outdef" default:"func_result" description:"Result row definition function"` IndexFunc string `long:"index" default:"index" description:"Available functions list"` ArgSyntax string `long:"arg_syntax" default:":=" description:"Default named args syntax (:= or =>)"` ArgTrimPrefix string `long:"arg_prefix" default:"a_" description:"Trim prefix from arg name"` }
Config defines local application flags
type DB ¶
type DB interface { QueryProc(method string, args ...interface{}) ([]map[string]interface{}, error) Exec(sql string, arguments ...interface{}) (int64, error) QueryMaps(sql string, args ...interface{}) ([]map[string]interface{}, error) Query(sql string, args ...interface{}) ([]interface{}, error) }
DB holda all of database methods used (see pgxpgcall)
type InDef ¶
type InDef struct { Name string `db:"arg"` Type string `db:"type"` Required bool `db:"required"` // TODO: is_required Default *string `db:"def_val" json:",omitempty"` Anno *string `db:"anno" json:",omitempty"` }
InDef holds function argument attributes
type Method ¶
type Method struct { Name string `db:"code"` Class string `db:"nspname"` Func string `db:"proname"` Anno string `db:"anno"` IsRO bool `db:"is_ro"` IsSet bool `db:"is_set"` IsStruct bool `db:"is_struct"` Sample *string `db:"sample" json:",omitempty"` Result *string `db:"result" json:",omitempty"` In map[string]InDef //`json:",omitempty"` Out []OutDef //`json:",omitempty"` }
Method holds method attributes
type OutDef ¶
type OutDef struct { Name string `db:"arg"` Type string `db:"type"` Anno *string `db:"anno" json:",omitempty"` }
OutDef holds function result attributes
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server holds RPC methods
func (*Server) Call ¶
func (srv *Server) Call(r *http.Request, method string, args map[string]interface{}, ) (interface{}, error)
Call postgresql stored function
func (*Server) LoadMethods ¶
LoadMethods load methods for nsp if given, all of methods otherwise
Click to show internal directories.
Click to hide internal directories.