Documentation ¶
Index ¶
- Constants
- func Columns(cols ...string) []string
- func RegisterDialect(name string, d *Dialect)
- type Config
- type Dialect
- type FootREST
- func (r *FootREST) BuildDeleteStmt(table string, whereSExpr string) (string, []any, error)
- func (r *FootREST) BuildGetStmt(table string, selColumns []string, whereSExpr string, orderColumns []string) (string, []any, error)
- func (r *FootREST) BuildPostStmt(table string, values any) (string, []any, error)
- func (r *FootREST) BuildPutStmt(table string, values map[string]any, whereSExpr string) (string, []any, error)
- func (r *FootREST) Delete(ctx context.Context, table string, where string) (int64, error)
- func (r *FootREST) Get(ctx context.Context, table string, selColumns []string, whereSExpr string, ...) ([]string, [][]any, error)
- func (r *FootREST) Post(ctx context.Context, table string, values any) (int64, error)
- func (r *FootREST) Put(ctx context.Context, table string, set map[string]any, where string) (int64, error)
- func (r *FootREST) Serve()
- type Operator
- type OperatorFormatter
- type ResponseFormat
Constants ¶
View Source
const DefaultOperatorFormat = `$1 {OPERATOR} $2`
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Format ResponseFormat Timeout int64 Addr string Root string ParamSelect string ParamWhere string ParamOrder string }
func DefaultConfig ¶
func DefaultConfig() *Config
type Dialect ¶
type Dialect struct { Operators map[string]Operator // key(Operator.Name) must be upper case. Placeholder func(int) string }
The best way to define a dialect is use DefaultDialect() and tweek the returned dialect.
func DefaultDialect ¶
func DefaultDialect() Dialect
func GetDialect ¶
func (*Dialect) AddOperator ¶
func (d *Dialect) AddOperator(name string, format string, f ...OperatorFormatter)
type FootREST ¶
type FootREST struct {
// contains filtered or unexported fields
}
func (*FootREST) BuildDeleteStmt ¶
func (*FootREST) BuildGetStmt ¶
func (*FootREST) BuildPostStmt ¶
func (*FootREST) BuildPutStmt ¶
type Operator ¶
type Operator struct { Name string Format string // "$1 == $2", "$1 BETWEEN $2 AND $3" Formatter OperatorFormatter // optional }
type OperatorFormatter ¶
type ResponseFormat ¶
Click to show internal directories.
Click to hide internal directories.