tpl

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnalyzeTPLFromCache

func AnalyzeTPLFromCache(template xdb.SQLTemplate, sqlTpl string, input map[string]any, opts ...xdb.TemplateOption) (sql string, values []any, err error)

AnalyzeTPLFromCache 从缓存中获取已解析的SQL语句

func NewDefaultTemplateMatcher added in v0.7.0

func NewDefaultTemplateMatcher(matchers ...xdb.ExpressionMatcher) xdb.TemplateMatcher

新建一个默认模板匹配器

func NewExpressionMatcherMap added in v0.7.0

func NewExpressionMatcherMap() xdb.ExpressionMatcherMap

Types

type DefaultExpressionMatcherMapImpl added in v0.7.0

type DefaultExpressionMatcherMapImpl struct {
	// contains filtered or unexported fields
}

DefaultExpressionMatcherMapImpl 默认表达式匹配器实现

func (*DefaultExpressionMatcherMapImpl) Clone added in v0.7.0

func (*DefaultExpressionMatcherMapImpl) Delete added in v0.7.0

func (m *DefaultExpressionMatcherMapImpl) Delete(name string)

func (*DefaultExpressionMatcherMapImpl) Find added in v0.7.0

func (*DefaultExpressionMatcherMapImpl) GetMatcherRegexp added in v0.7.0

func (m *DefaultExpressionMatcherMapImpl) GetMatcherRegexp() *regexp.Regexp

func (*DefaultExpressionMatcherMapImpl) Load added in v0.7.0

func (*DefaultExpressionMatcherMapImpl) Regist added in v0.7.0

func (m *DefaultExpressionMatcherMapImpl) Regist(matchers ...xdb.ExpressionMatcher)

type DefaultTemplateMatcher added in v0.7.0

type DefaultTemplateMatcher struct {
	// contains filtered or unexported fields
}

ExpressionMatcher 默认表达式匹配器

func (*DefaultTemplateMatcher) GenerateSQL added in v0.7.0

func (conn *DefaultTemplateMatcher) GenerateSQL(state xdb.SqlState, sqlTpl string, input xdb.DBParam) (sql string, err error)

func (*DefaultTemplateMatcher) RegistMatcher added in v0.7.0

func (conn *DefaultTemplateMatcher) RegistMatcher(matchers ...xdb.ExpressionMatcher)

type FixedTemplate added in v0.7.0

type FixedTemplate struct {
	// contains filtered or unexported fields
}

FixedTemplate 模板

func NewFixed

func NewFixed(name, prefix string, matcher xdb.TemplateMatcher) *FixedTemplate

func (*FixedTemplate) GetSQLContext added in v0.7.0

func (template *FixedTemplate) GetSQLContext(sqlTpl string, input map[string]interface{}, opts ...xdb.TemplateOption) (query string, args []any, err error)

GetSQLContext 获取查询串

func (*FixedTemplate) GetSqlState added in v0.7.0

func (template *FixedTemplate) GetSqlState(tplOpts *xdb.TemplateOptions) xdb.SqlState

func (*FixedTemplate) HandleExpr added in v0.7.0

func (template *FixedTemplate) HandleExpr(item xdb.SqlState, sqlTpl string, input xdb.DBParam) (sql string, err error)

func (FixedTemplate) Name added in v0.7.0

func (template FixedTemplate) Name() string

func (*FixedTemplate) Placeholder added in v0.7.0

func (template *FixedTemplate) Placeholder() xdb.Placeholder

func (*FixedTemplate) RegistExpressionMatcher added in v0.7.0

func (template *FixedTemplate) RegistExpressionMatcher(matchers ...xdb.ExpressionMatcher)

func (*FixedTemplate) ReleaseSqlState added in v0.7.0

func (template *FixedTemplate) ReleaseSqlState(state xdb.SqlState)

type SeqTemplate added in v0.7.0

type SeqTemplate struct {
	// contains filtered or unexported fields
}

SeqTemplate 参数化时使用@+参数名作为占位符的SQL数据库如:oracle,sql server

func NewSeq

func NewSeq(name, prefix string, matcher xdb.TemplateMatcher) *SeqTemplate

func (*SeqTemplate) GetSQLContext added in v0.7.0

func (template *SeqTemplate) GetSQLContext(sqlTpl string, input map[string]interface{}, opts ...xdb.TemplateOption) (query string, args []any, err error)

GetSQLContext 获取查询串

func (*SeqTemplate) GetSqlState added in v0.7.0

func (template *SeqTemplate) GetSqlState(tplOpts *xdb.TemplateOptions) xdb.SqlState

func (*SeqTemplate) HandleExpr added in v0.7.0

func (template *SeqTemplate) HandleExpr(item xdb.SqlState, sqlTpl string, input xdb.DBParam) (sql string, err error)

func (SeqTemplate) Name added in v0.7.0

func (template SeqTemplate) Name() string

func (*SeqTemplate) Placeholder added in v0.7.0

func (template *SeqTemplate) Placeholder() xdb.Placeholder

func (*SeqTemplate) RegistExpressionMatcher added in v0.7.0

func (template *SeqTemplate) RegistExpressionMatcher(matchers ...xdb.ExpressionMatcher)

func (*SeqTemplate) ReleaseSqlState added in v0.7.0

func (template *SeqTemplate) ReleaseSqlState(state xdb.SqlState)

Jump to

Keyboard shortcuts

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