Documentation ¶
Index ¶
- Variables
- func AsBindings(key string, values []interface{}) (column string, bindings string)
- func NotZeroOf(values ...int) int
- func SetPanicOnError(value bool)
- type BindingsCache
- type BindingsExpander
- type Callback
- type ConstUpdater
- type Context
- type CriteriaColumn
- type CriteriaExpander
- type DataUnit
- func (c *DataUnit) Add(_ int, value interface{}) (string, error)
- func (c *DataUnit) Allocate(tableName string, dest interface{}, selector string) (string, error)
- func (c *DataUnit) AppendBinding(value interface{}) (string, error)
- func (c *DataUnit) AsBinding(value interface{}) (string, error)
- func (c *DataUnit) AsColumn(columnName string) (string, error)
- func (c *DataUnit) At(_ int) []interface{}
- func (c *DataUnit) Contains(columnName string, args interface{}) (string, error)
- func (c *DataUnit) Delete(data interface{}, name string) (string, error)
- func (c *DataUnit) FilterExecutables(statements []string, stopOnNonExec bool) []*Executable
- func (c *DataUnit) In(columnName string, args interface{}) (string, error)
- func (c *DataUnit) Insert(data interface{}, tableName string) (string, error)
- func (c *DataUnit) IsServiceExec(SQL string) (*Executable, bool)
- func (c *DataUnit) Like(columnName string, args interface{}) (string, error)
- func (c *DataUnit) Next() (interface{}, error)
- func (c *DataUnit) NotContains(columnName string, args interface{}) (string, error)
- func (c *DataUnit) NotIn(columnName string, args interface{}) (string, error)
- func (c *DataUnit) NotLike(columnName string, args interface{}) (string, error)
- func (c *DataUnit) UUID() string
- func (c *DataUnit) Update(data interface{}, tableName string) (string, error)
- func (c *DataUnit) Validate(dest interface{}, opts ...interface{}) (*validator.Validation, error)
- func (c *DataUnit) WithLocation(loc string) interface{}
- func (c *DataUnit) WithPresence() interface{}
- type Dber
- type Dereferencer
- type Differ
- type EmbeddableMap
- type ErrorHandler
- type ErrorResponse
- type Evaluator
- type EvaluatorOption
- func WithCustomContexts(ctx ...*Variable) EvaluatorOption
- func WithPanicOnError(b bool) EvaluatorOption
- func WithPredicates(configs []*PredicateConfig) EvaluatorOption
- func WithSetLiteral(setLiterals func(state *structology.State) error) EvaluatorOption
- func WithStateName(name string) EvaluatorOption
- func WithStateType(stateType *structology.StateType) EvaluatorOption
- func WithTypeLookup(lookup xreflect.LookupType) EvaluatorOption
- func WithVariable(namedVariable ...*NamedVariable) EvaluatorOption
- type ExecType
- type Executable
- type ExecutablesIndex
- type Expander
- type Expression
- type Flushable
- type HTTPStatus
- type Http
- func (h *Http) Defer() HTTPStatus
- func (h *Http) DeferOnFailure() HTTPStatus
- func (h *Http) DeferOnSuccess() HTTPStatus
- func (h *Http) Do(method string, URL string, input interface{}, args ...interface{}) (HttpResponse, error)
- func (h *Http) Flush(status HTTPStatus) error
- func (h *Http) Get(url string) (HttpResponse, error)
- func (h *Http) OnError(callback Callback) ErrorHandler
- func (h *Http) OnSuccess(callback Callback) ErrorHandler
- func (h *Http) Post(url string, body interface{}) (HttpResponse, error)
- func (h *Http) StatusCode(code int) StatusCode
- type HttpResponse
- type HttpValidation
- type MockExpander
- type NamedVariable
- type ParentBatch
- type ParentExtras
- type ParentSource
- type Predicate
- type PredicateBuilder
- func (b *PredicateBuilder) And() *PredicateBuilder
- func (b *PredicateBuilder) Build(keyword string) string
- func (b *PredicateBuilder) Combine(fragments ...string) *PredicateBuilder
- func (b *PredicateBuilder) CombineAnd(fragments ...string) *PredicateBuilder
- func (b *PredicateBuilder) CombineOr(fragments ...string) *PredicateBuilder
- func (b *PredicateBuilder) Or() *PredicateBuilder
- type PredicateConfig
- type PrimitiveExpander
- type Printer
- func (p *Printer) Debugf(format string, params ...interface{}) string
- func (p *Printer) Discover(aFunc interface{}) (func(operands []*op.Operand, state *est.State) (interface{}, error), ...)
- func (p *Printer) Fatal(any interface{}, args ...interface{}) (string, error)
- func (p *Printer) Fatalf(any interface{}, args ...interface{}) (string, error)
- func (p *Printer) FatalfWithCode(code int, any interface{}, args ...interface{}) (string, error)
- func (p *Printer) Flush()
- func (p *Printer) Log(format string, args ...interface{}) string
- func (p *Printer) Logf(format string, args ...interface{}) string
- func (p *Printer) Printf(format string, args ...interface{}) string
- func (p *Printer) Println(args ...interface{}) string
- func (p *Printer) Sprintf(format string, args ...interface{}) string
- type ResponseBuilder
- func (b *ResponseBuilder) Add(key string, value interface{}) string
- func (b *ResponseBuilder) CallbackAdd(key string, value interface{}) Callback
- func (b *ResponseBuilder) CallbackFailf(format string, args ...interface{}) Callback
- func (b *ResponseBuilder) CallbackFailfWithStatusCode(statusCode int, format string, args ...interface{}) Callback
- func (b *ResponseBuilder) CallbackPut(key string, value interface{}) Callback
- func (b *ResponseBuilder) CallbackStatusCode(statusCode int) Callback
- func (b *ResponseBuilder) Failf(format string, args ...interface{}) (string, error)
- func (b *ResponseBuilder) FailfWithStatusCode(statusCode int, format string, args ...interface{}) (string, error)
- func (b *ResponseBuilder) Put(key string, value interface{}) string
- func (b *ResponseBuilder) StatusCode(statusCode int) string
- type SQLStatment
- type SliceExpander
- type State
- type StateOption
- func WithCustomContext(customContext *Variable) StateOption
- func WithDataUnit(dataUnit *DataUnit) StateOption
- func WithNamedVariables(variables ...*NamedVariable) StateOption
- func WithParameterState(parametersState *structology.State) StateOption
- func WithParentViewParam(viewParam *ViewContext) StateOption
- func WithSession(session *extension.Session) StateOption
- func WithViewParam(viewParam *ViewContext) StateOption
- type Statements
- func (s *Statements) Delete(name string, data interface{})
- func (s *Statements) DeleteWithMarker(tableName string, data interface{}) string
- func (s *Statements) Execute(SQLStmt *SQLStatment)
- func (s *Statements) FilterByTableName(name string) []interface{}
- func (s *Statements) Insert(tableName string, data interface{})
- func (s *Statements) InsertWithMarker(tableName string, data interface{}) string
- func (s *Statements) LookupExecutable(sql string) (*Executable, bool)
- func (s *Statements) NextNonExecuted() (*Executable, bool)
- func (s *Statements) Update(tableName string, data interface{})
- func (s *Statements) UpdateWithMarker(tableName string, data interface{}) string
- type StatusCode
- type Validator
- type Variable
- type ViewContext
- func (m *ViewContext) AndParentJoinOn(column string) (string, error)
- func (m *ViewContext) ColIn(prefix, column string) (string, error)
- func (m *ViewContext) Expand(_ *DataUnit) string
- func (m *ViewContext) In(prefix string) (string, error)
- func (m *ViewContext) ParentJoinOn(column string, prepend ...string) (string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var PredicateCtx predicateCtx = "ctx"
View Source
var PredicateState predicateState = "state"
Functions ¶
func AsBindings ¶
func SetPanicOnError ¶
func SetPanicOnError(value bool)
Types ¶
type BindingsCache ¶
type BindingsCache struct {
// contains filtered or unexported fields
}
func (*BindingsCache) Lookup ¶
func (b *BindingsCache) Lookup(value interface{}) (BindingsExpander, error)
type BindingsExpander ¶
type ConstUpdater ¶
type ConstUpdater interface {
UpdateValue(params interface{}, presenceMap interface{}) error
}
type Context ¶
type Context struct { Printer *Printer `velty:"names=logger|fmt"` DataUnit *DataUnit `velty:"names=sql|sqlx|sequencer|criteria"` Http *Http `velty:"names=http"` ResponseBuilder *ResponseBuilder `velty:"names=response"` ViewContext *ViewContext `velty:"names=View"` ParentViewContext *ViewContext `velty:"names=ParentView"` Session *extension.Session `velty:"names=session"` Validator *validator.Service `velty:"names=validator"` MessageBus *mbus.Service `velty:"names=messageBus"` Predicate *Predicate `velty:"names=predicate"` Filters predicate.Filters `velty:"names=filters"` }
type CriteriaColumn ¶
func ParseDatlyTag ¶
func ParseDatlyTag(field reflect.StructField) (*CriteriaColumn, error)
type CriteriaExpander ¶
type CriteriaExpander struct {
// contains filtered or unexported fields
}
func (*CriteriaExpander) ColumnExpression ¶
func (c *CriteriaExpander) ColumnExpression(source string) string
func (*CriteriaExpander) Expand ¶
func (c *CriteriaExpander) Expand(source string, value interface{}) ([]*Expression, error)
func (*CriteriaExpander) HasAny ¶
func (c *CriteriaExpander) HasAny(value interface{}) bool
type DataUnit ¶
type DataUnit struct { Columns codec.ColumnsSource ParamsGroup []interface{} Mock bool TemplateSQL string MetaSource Dber `velty:"-"` Statements *Statements `velty:"-"` // contains filtered or unexported fields }
func NewDataUnit ¶
func (*DataUnit) AppendBinding ¶
func (*DataUnit) FilterExecutables ¶
func (c *DataUnit) FilterExecutables(statements []string, stopOnNonExec bool) []*Executable
func (*DataUnit) IsServiceExec ¶
func (c *DataUnit) IsServiceExec(SQL string) (*Executable, bool)
func (*DataUnit) NotContains ¶
func (*DataUnit) Validate ¶
func (c *DataUnit) Validate(dest interface{}, opts ...interface{}) (*validator.Validation, error)
func (*DataUnit) WithLocation ¶
func (*DataUnit) WithPresence ¶
func (c *DataUnit) WithPresence() interface{}
type Dereferencer ¶
type Dereferencer struct {
// contains filtered or unexported fields
}
type EmbeddableMap ¶
type EmbeddableMap map[string]interface{}
type ErrorHandler ¶
type ErrorResponse ¶
type ErrorResponse struct { Content EmbeddableMap Message string StatusCode int }
func (*ErrorResponse) Error ¶
func (h *ErrorResponse) Error() string
func (*ErrorResponse) ErrorMessage ¶
func (h *ErrorResponse) ErrorMessage() string
func (*ErrorResponse) ErrorStatusCode ¶
func (h *ErrorResponse) ErrorStatusCode() int
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
func NewEvaluator ¶
func NewEvaluator(template string, options ...EvaluatorOption) (*Evaluator, error)
type EvaluatorOption ¶
type EvaluatorOption func(c *config)
func WithCustomContexts ¶
func WithCustomContexts(ctx ...*Variable) EvaluatorOption
func WithPanicOnError ¶
func WithPanicOnError(b bool) EvaluatorOption
func WithPredicates ¶
func WithPredicates(configs []*PredicateConfig) EvaluatorOption
func WithSetLiteral ¶
func WithSetLiteral(setLiterals func(state *structology.State) error) EvaluatorOption
func WithStateName ¶
func WithStateName(name string) EvaluatorOption
func WithStateType ¶
func WithStateType(stateType *structology.StateType) EvaluatorOption
func WithTypeLookup ¶
func WithTypeLookup(lookup xreflect.LookupType) EvaluatorOption
func WithVariable ¶
func WithVariable(namedVariable ...*NamedVariable) EvaluatorOption
type Executable ¶
type Executable struct { Table string ExecType ExecType Data interface{} IsLast bool // contains filtered or unexported fields }
func (*Executable) Executed ¶
func (e *Executable) Executed() bool
func (*Executable) MarkAsExecuted ¶
func (e *Executable) MarkAsExecuted()
type ExecutablesIndex ¶
type ExecutablesIndex map[string]*Executable
func (ExecutablesIndex) UpdateLastExecutable ¶
func (i ExecutablesIndex) UpdateLastExecutable(execType ExecType, tableName string, newExecutable *Executable)
type Expression ¶
func NewSingleExpression ¶
func NewSingleExpression(expression string, fragment string, args []interface{}) []*Expression
type Flushable ¶
type Flushable struct { Handler func() error OnStatus HTTPStatus }
type HTTPStatus ¶
type HTTPStatus int
const ( StatusUnspecified HTTPStatus = iota StatusDefault StatusFailure StatusSuccess )
type Http ¶
type Http struct {
// contains filtered or unexported fields
}
func (*Http) Defer ¶
func (h *Http) Defer() HTTPStatus
func (*Http) DeferOnFailure ¶
func (h *Http) DeferOnFailure() HTTPStatus
func (*Http) DeferOnSuccess ¶
func (h *Http) DeferOnSuccess() HTTPStatus
func (*Http) Do ¶
func (h *Http) Do(method string, URL string, input interface{}, args ...interface{}) (HttpResponse, error)
func (*Http) Flush ¶
func (h *Http) Flush(status HTTPStatus) error
func (*Http) OnError ¶
func (h *Http) OnError(callback Callback) ErrorHandler
func (*Http) OnSuccess ¶
func (h *Http) OnSuccess(callback Callback) ErrorHandler
func (*Http) StatusCode ¶
func (h *Http) StatusCode(code int) StatusCode
type HttpResponse ¶
type HttpResponse struct { HttpValidation IsPostponed bool StatusCode int Body string }
type HttpValidation ¶
type MockExpander ¶
type MockExpander struct{}
func (*MockExpander) AndParentJoinOn ¶
func (e *MockExpander) AndParentJoinOn(column string) (string, error)
func (*MockExpander) ParentJoinOn ¶
func (e *MockExpander) ParentJoinOn(column string, prepend ...string) (string, error)
type NamedVariable ¶
func (*NamedVariable) New ¶
func (v *NamedVariable) New(value interface{}) *NamedVariable
type ParentBatch ¶
type ParentBatch interface { ColIn() []interface{} ColInBatch() []interface{} }
type ParentExtras ¶
type ParentSource ¶
type Predicate ¶
type Predicate struct {
// contains filtered or unexported fields
}
func NewPredicate ¶
func NewPredicate(ctx *Context, state *structology.State, config []*PredicateConfig) *Predicate
func (*Predicate) Builder ¶
func (p *Predicate) Builder() *PredicateBuilder
func (*Predicate) ExpandWith ¶
type PredicateBuilder ¶
type PredicateBuilder struct {
// contains filtered or unexported fields
}
func (*PredicateBuilder) And ¶
func (b *PredicateBuilder) And() *PredicateBuilder
func (*PredicateBuilder) Build ¶
func (b *PredicateBuilder) Build(keyword string) string
func (*PredicateBuilder) Combine ¶
func (b *PredicateBuilder) Combine(fragments ...string) *PredicateBuilder
func (*PredicateBuilder) CombineAnd ¶
func (b *PredicateBuilder) CombineAnd(fragments ...string) *PredicateBuilder
func (*PredicateBuilder) CombineOr ¶
func (b *PredicateBuilder) CombineOr(fragments ...string) *PredicateBuilder
func (*PredicateBuilder) Or ¶
func (b *PredicateBuilder) Or() *PredicateBuilder
type PredicateConfig ¶
type PredicateConfig struct { Group int Selector *structology.Selector `velty:"-"` Expander codec.PredicateHandler Ensure bool }
type PrimitiveExpander ¶
type PrimitiveExpander struct { }
func (*PrimitiveExpander) ColumnExpression ¶
func (p *PrimitiveExpander) ColumnExpression(source string) string
func (*PrimitiveExpander) Expand ¶
func (p *PrimitiveExpander) Expand(source string, value interface{}) ([]*Expression, error)
func (*PrimitiveExpander) HasAny ¶
func (p *PrimitiveExpander) HasAny(value interface{}) bool
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
func (*Printer) FatalfWithCode ¶
FatalfWithCode logs and terminate with status code
type ResponseBuilder ¶
type ResponseBuilder struct { Content map[string]interface{} `velty:"-"` ResponseCode int `velty:"-"` }
func (*ResponseBuilder) Add ¶
func (b *ResponseBuilder) Add(key string, value interface{}) string
func (*ResponseBuilder) CallbackAdd ¶
func (b *ResponseBuilder) CallbackAdd(key string, value interface{}) Callback
func (*ResponseBuilder) CallbackFailf ¶
func (b *ResponseBuilder) CallbackFailf(format string, args ...interface{}) Callback
func (*ResponseBuilder) CallbackFailfWithStatusCode ¶
func (b *ResponseBuilder) CallbackFailfWithStatusCode(statusCode int, format string, args ...interface{}) Callback
func (*ResponseBuilder) CallbackPut ¶
func (b *ResponseBuilder) CallbackPut(key string, value interface{}) Callback
func (*ResponseBuilder) CallbackStatusCode ¶
func (b *ResponseBuilder) CallbackStatusCode(statusCode int) Callback
func (*ResponseBuilder) Failf ¶
func (b *ResponseBuilder) Failf(format string, args ...interface{}) (string, error)
func (*ResponseBuilder) FailfWithStatusCode ¶
func (b *ResponseBuilder) FailfWithStatusCode(statusCode int, format string, args ...interface{}) (string, error)
func (*ResponseBuilder) Put ¶
func (b *ResponseBuilder) Put(key string, value interface{}) string
func (*ResponseBuilder) StatusCode ¶
func (b *ResponseBuilder) StatusCode(statusCode int) string
type SQLStatment ¶
type SQLStatment struct { SQL string Args []interface{} }
type SliceExpander ¶
type SliceExpander struct {
// contains filtered or unexported fields
}
func (*SliceExpander) ColumnExpression ¶
func (s *SliceExpander) ColumnExpression(source string) string
func (*SliceExpander) Expand ¶
func (s *SliceExpander) Expand(source string, value interface{}) ([]*Expression, error)
func (*SliceExpander) HasAny ¶
func (s *SliceExpander) HasAny(value interface{}) bool
type State ¶
type State struct { *est.State *Context ParametersState *structology.State EmbededVariables []*Variable NamedVariables []*NamedVariable Expanded string // contains filtered or unexported fields }
func StateWithSQL ¶
func (*State) Flush ¶
func (s *State) Flush(status HTTPStatus) error
func (*State) Init ¶
func (s *State) Init(templateState *est.State, predicates []*PredicateConfig, options ...StateOption)
type StateOption ¶
type StateOption func(state *State)
func WithCustomContext ¶
func WithCustomContext(customContext *Variable) StateOption
func WithDataUnit ¶
func WithDataUnit(dataUnit *DataUnit) StateOption
func WithNamedVariables ¶
func WithNamedVariables(variables ...*NamedVariable) StateOption
func WithParameterState ¶
func WithParameterState(parametersState *structology.State) StateOption
func WithParentViewParam ¶
func WithParentViewParam(viewParam *ViewContext) StateOption
func WithSession ¶
func WithSession(session *extension.Session) StateOption
func WithViewParam ¶
func WithViewParam(viewParam *ViewContext) StateOption
type Statements ¶
type Statements struct { Executable []interface{} Index ExecutablesIndex Markers map[string]int // contains filtered or unexported fields }
func NewStmtHolder ¶
func NewStmtHolder() *Statements
func (*Statements) Delete ¶
func (s *Statements) Delete(name string, data interface{})
func (*Statements) DeleteWithMarker ¶
func (s *Statements) DeleteWithMarker(tableName string, data interface{}) string
func (*Statements) Execute ¶
func (s *Statements) Execute(SQLStmt *SQLStatment)
func (*Statements) FilterByTableName ¶
func (s *Statements) FilterByTableName(name string) []interface{}
func (*Statements) Insert ¶
func (s *Statements) Insert(tableName string, data interface{})
func (*Statements) InsertWithMarker ¶
func (s *Statements) InsertWithMarker(tableName string, data interface{}) string
func (*Statements) LookupExecutable ¶
func (s *Statements) LookupExecutable(sql string) (*Executable, bool)
func (*Statements) NextNonExecuted ¶
func (s *Statements) NextNonExecuted() (*Executable, bool)
func (*Statements) Update ¶
func (s *Statements) Update(tableName string, data interface{})
func (*Statements) UpdateWithMarker ¶
func (s *Statements) UpdateWithMarker(tableName string, data interface{}) string
type StatusCode ¶
type StatusCode int
type Validator ¶
type Validator struct {
Service *govalidator.Service
}
func CommonValidator ¶
func CommonValidator() *Validator
func (*Validator) Validate ¶
func (c *Validator) Validate(dest interface{}, opts ...interface{}) (*govalidator.Validation, error)
Validate validates destination
func (*Validator) WithLocation ¶
func (c *Validator) WithLocation(loc string) govalidator.Option
func (*Validator) WithPresence ¶
func (c *Validator) WithPresence() govalidator.Option
type ViewContext ¶
type ViewContext struct { Name string Alias string Table string Limit int Offset int Page int Args []interface{} NonWindowSQL string ParentValues []interface{} DataUnit *DataUnit `velty:"-"` // contains filtered or unexported fields }
func NewViewContext ¶
func NewViewContext(metaSource ParentSource, aSelector ParentExtras, batchData ParentBatch, options ...interface{}) *ViewContext
func (*ViewContext) AndParentJoinOn ¶
func (m *ViewContext) AndParentJoinOn(column string) (string, error)
func (*ViewContext) Expand ¶
func (m *ViewContext) Expand(_ *DataUnit) string
AddRelation appends SQL and adds binding arguments Deprecated: For the backward compatibility
func (*ViewContext) ParentJoinOn ¶
func (m *ViewContext) ParentJoinOn(column string, prepend ...string) (string, error)
Click to show internal directories.
Click to hide internal directories.