Documentation
¶
Index ¶
- func ConvertArray[T any, U any](arrayOfInterfaces []T) (*[]U, error)
- func ConvertMap[T any, U any](data map[string]T) (map[string]U, error)
- func ExtractSQLParameter(statement string) string
- func ExtractScriptParamsFromMap(m map[string]any) map[string]any
- func Hook(clean func())
- func IsQuery(sql string) bool
- func ShouldExport(sql string) bool
- func SplitSqlLabel(sqlString string) (label string, s string)
- func SqlNormalize(sql *string)
- type App
- func (this *App) BuildScript(scriptString string, scriptId string) (*Script, error)
- func (this *App) GetDB(dbName string) *sql.DB
- func (this *App) GetScript(scriptId string, forceReload bool) (*Script, error)
- func (this *App) RegisterGlobalInterceptors(is ...Interceptor)
- func (this *App) RegisterScriptInterceptors(scriptID string, is ...Interceptor)
- func (this *App) SendMail(from, subject, body string, to ...string) error
- func (this *App) Start()
- type AuthLevel
- type Config
- type Context
- type Database
- type DefaultInterceptor
- func (this *DefaultInterceptor) After(tx *sql.Tx, context *Context, exportedResults any, cumulativeResults any) error
- func (this *DefaultInterceptor) AfterEach(tx *sql.Tx, context *Context, statement *Statement, ...) error
- func (this *DefaultInterceptor) Before(tx *sql.Tx, context *Context) error
- func (this *DefaultInterceptor) BeforeEach(tx *sql.Tx, context *Context, statement *Statement, ...) (bool, error)
- func (this *DefaultInterceptor) GetAuthLevel() AuthLevel
- type Interceptor
- type Mail
- type Script
- type Statement
- type Web
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertArray ¶
func ExtractSQLParameter ¶
func ShouldExport ¶
true if the first character is uppercase, false otherwise
func SplitSqlLabel ¶
func SqlNormalize ¶
func SqlNormalize(sql *string)
returns whether to export the result of this sql statement or not
Types ¶
type App ¶
type App struct { Config *Config Databases map[string]*sql.DB Cache *gorediscache.Cache Scripts map[string]*Script Interceptors map[string][]Interceptor GlobalInterceptors []Interceptor }
func (*App) BuildScript ¶
func (*App) RegisterGlobalInterceptors ¶
func (this *App) RegisterGlobalInterceptors(is ...Interceptor)
func (*App) RegisterScriptInterceptors ¶
func (this *App) RegisterScriptInterceptors(scriptID string, is ...Interceptor)
type Config ¶
type DefaultInterceptor ¶
type DefaultInterceptor struct { }
func (*DefaultInterceptor) Before ¶
func (this *DefaultInterceptor) Before(tx *sql.Tx, context *Context) error
func (*DefaultInterceptor) BeforeEach ¶
func (*DefaultInterceptor) GetAuthLevel ¶
func (this *DefaultInterceptor) GetAuthLevel() AuthLevel
type Interceptor ¶
type Interceptor interface { Before(tx *sql.Tx, context *Context) error After(tx *sql.Tx, context *Context, exportedResults any, cumulativeResults any) error BeforeEach(tx *sql.Tx, context *Context, statement *Statement, cumulativeResults map[string]any) (bool, error) AfterEach(tx *sql.Tx, context *Context, statement *Statement, cumulativeResults map[string]any, result any) error GetAuthLevel() AuthLevel }
type Script ¶
type Script struct { ID string DBKey string Text string Statements []*Statement Interceptors []Interceptor }
Click to show internal directories.
Click to hide internal directories.