Documentation ¶
Index ¶
- func AnalyzeTPLFromCache(template xdb.SQLTemplate, sqlTpl string, input map[string]any, ...) (sql string, values []any, err error)
- func NewDefaultTemplateMatcher(matchers ...xdb.ExpressionMatcher) xdb.TemplateMatcher
- func NewExpressionMatcherMap() xdb.ExpressionMatcherMap
- type DefaultExpressionMatcherMapImpl
- func (m *DefaultExpressionMatcherMapImpl) Clone() xdb.ExpressionMatcherMap
- func (m *DefaultExpressionMatcherMapImpl) Delete(name string)
- func (m *DefaultExpressionMatcherMapImpl) Find(call func(matcher xdb.ExpressionMatcher) bool) xdb.ExpressionMatcher
- func (m *DefaultExpressionMatcherMapImpl) GetMatcherRegexp() *regexp.Regexp
- func (m *DefaultExpressionMatcherMapImpl) Load(name string) (xdb.ExpressionMatcher, bool)
- func (m *DefaultExpressionMatcherMapImpl) Regist(matchers ...xdb.ExpressionMatcher)
- type DefaultTemplateMatcher
- type FixedTemplate
- func (template *FixedTemplate) GetSQLContext(sqlTpl string, input map[string]interface{}, opts ...xdb.TemplateOption) (query string, args []any, err error)
- func (template *FixedTemplate) GetSqlState(tplOpts *xdb.TemplateOptions) xdb.SqlState
- func (template *FixedTemplate) HandleExpr(item xdb.SqlState, sqlTpl string, input xdb.DBParam) (sql string, err error)
- func (template FixedTemplate) Name() string
- func (template *FixedTemplate) Placeholder() xdb.Placeholder
- func (template *FixedTemplate) RegistExpressionMatcher(matchers ...xdb.ExpressionMatcher)
- func (template *FixedTemplate) ReleaseSqlState(state xdb.SqlState)
- type SeqTemplate
- func (template *SeqTemplate) GetSQLContext(sqlTpl string, input map[string]interface{}, opts ...xdb.TemplateOption) (query string, args []any, err error)
- func (template *SeqTemplate) GetSqlState(tplOpts *xdb.TemplateOptions) xdb.SqlState
- func (template *SeqTemplate) HandleExpr(item xdb.SqlState, sqlTpl string, input xdb.DBParam) (sql string, err error)
- func (template SeqTemplate) Name() string
- func (template *SeqTemplate) Placeholder() xdb.Placeholder
- func (template *SeqTemplate) RegistExpressionMatcher(matchers ...xdb.ExpressionMatcher)
- func (template *SeqTemplate) ReleaseSqlState(state xdb.SqlState)
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 (m *DefaultExpressionMatcherMapImpl) Clone() xdb.ExpressionMatcherMap
func (*DefaultExpressionMatcherMapImpl) Delete ¶ added in v0.7.0
func (m *DefaultExpressionMatcherMapImpl) Delete(name string)
func (*DefaultExpressionMatcherMapImpl) Find ¶ added in v0.7.0
func (m *DefaultExpressionMatcherMapImpl) Find(call func(matcher xdb.ExpressionMatcher) bool) xdb.ExpressionMatcher
func (*DefaultExpressionMatcherMapImpl) GetMatcherRegexp ¶ added in v0.7.0
func (m *DefaultExpressionMatcherMapImpl) GetMatcherRegexp() *regexp.Regexp
func (*DefaultExpressionMatcherMapImpl) Load ¶ added in v0.7.0
func (m *DefaultExpressionMatcherMapImpl) Load(name string) (xdb.ExpressionMatcher, bool)
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 (*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 (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 (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)
Click to show internal directories.
Click to hide internal directories.