Documentation
¶
Index ¶
- Variables
- func AddDialectByConfigDir(configDir string) (err error)
- func AddDialectByConfigFile(configFile string) (err error)
- func DoExec(ctx context.Context, sqlConn SqlConn, sqlInfo string, args []interface{}, ...) (result sql.Result, err error)
- func DoExecBatch(ctx context.Context, sqlConn SqlConn, sqlInfo string, argsList [][]interface{}, ...) (res []sql.Result, err error)
- func DoExecs(ctx context.Context, sqlConn SqlConn, sqlList []string, ...) (resultList []sql.Result, errSql string, errArgs []interface{}, err error)
- func DoQuery(ctx context.Context, sqlConn SqlConn, sqlInfo string, args []interface{}, ...) (list []map[string]interface{}, err error)
- func DoQueryCount(ctx context.Context, sqlConn SqlConn, sqlInfo string, args []interface{}, ...) (count int64, err error)
- func DoQueryListStruct[S any](ctx context.Context, sqlConn SqlConn, sqlInfo string, args []interface{}, ...) (list []S, err error)
- func DoQueryListStructWithService[S any](ctx context.Context, service IService, sqlInfo string, args []interface{}) (res []S, err error)
- func DoQueryListWithModel[S any](ctx context.Context, s IModelSql) (res []S, err error)
- func DoQueryListWithSql[S any](ctx context.Context, service IService, sqlInfo string, sqlArgs []any) (res []S, err error)
- func DoQueryOne(ctx context.Context, sqlConn SqlConn, sqlInfo string, args []interface{}, ...) (data map[string]interface{}, err error)
- func DoQueryOneStruct[S any](ctx context.Context, sqlConn SqlConn, sqlInfo string, args []interface{}, ...) (res S, err error)
- func DoQueryOneStructWithService[S any](ctx context.Context, service IService, sqlInfo string, args []interface{}) (res S, err error)
- func DoQueryOneWithModel[S any](ctx context.Context, s IModelSql) (res S, err error)
- func DoQueryOneWithSql[S any](ctx context.Context, service IService, sqlInfo string, sqlArgs []any) (res S, err error)
- func DoQueryPageWithModel[S any](ctx context.Context, s IModelSql, pageSize int64, pageNo int64) (res []S, err error)
- func DoQueryPageWithSql[S any](ctx context.Context, service IService, sqlInfo string, sqlArgs []any, ...) (res []S, err error)
- func DoQueryWithColumnTypes(ctx context.Context, sqlConn SqlConn, sqlInfo string, args []interface{}, ...) (columns []string, columnTypes []*sql.ColumnType, list []map[string]any, ...)
- func DoTxExec(ctx context.Context, sqlConn SqlConn, sqlInfo string, args []interface{}, ...) (result sql.Result, err error)
- func DoTxExecs(ctx context.Context, sqlConn SqlConn, sqlList []string, ...) (resultList []sql.Result, errSql string, errArgs []interface{}, err error)
- func FormatColumnType(columnType string) (dataType string, length int, precision int, scale int)
- func FormatDriverDSN(driverDSN string, dbCfg *Config, isUrl bool, paramSpaceChar string, ...) string
- func GetBaseTypeValue(data any) (res any, is bool)
- func GetInsertOrUpdateColumnValues(list []*InsertOrUpdateValue) (columns []string, values []*util.FieldValue)
- func GetParamValue(dbCfg *Config, name string) string
- func GetSqlValue(columnType *sql.ColumnType, data any) (value any)
- func GetStringValue(value any) (valueString string)
- func HasNewLine(str string) bool
- func IsFloat(s string) bool
- func IsIdentifier(s string) bool
- func IsInt(s string) bool
- func IsInt64Value(value any) (res int64, ok bool)
- func IsNumber(s string) bool
- func IsTrue(arg any) bool
- func IsWhiteSpace(s string) bool
- func NewSqlDb(cfg *Config) (sqlDb *sql.DB, err error)
- func ParserToFormat(str string) (formatStr string, names []string)
- func SqlParamParse(sqlInfo string, param any) (string, []any, error)
- func SqlTemplateHasContent(t *SqlTemplate) bool
- func TableColumnAdd(dbService IService, moduleName, version, tableName string, column *Column) (err error)
- func TableColumnDrop(dbService IService, moduleName, version, tableName string, columnName string) (err error)
- func TableCreate(dbService IService, moduleName, version, tableName string, table *Table) (err error)
- func TableIndexAdd(dbService IService, moduleName, version, tableName string, index *Index) (err error)
- func TableIndexDrop(dbService IService, moduleName, version, tableName string, indexName string) (err error)
- func ToInt64Value(value any) (res int64, err error)
- func ToIntValue(value any) (res int, err error)
- func ToKeyValueParams(params map[string]string, paramSpaceChar string) (res string)
- func ToUrlParams(params map[string]string) (res string)
- type ChangeSqlReader
- type Column
- type Condition
- type Conditions
- func (cs *Conditions) And(field string, op Op, value any) *Conditions
- func (cs *Conditions) AndGroup(sub *Conditions) *Conditions
- func (cs *Conditions) AndWhereSql(whereSql string, args ...any) *Conditions
- func (cs *Conditions) Build(b *OrmSqlBuilder, s IService) (string, []any)
- func (cs *Conditions) Custom(custom string, values []any) *Conditions
- func (cs *Conditions) Eq(field string, value any) *Conditions
- func (cs *Conditions) Gt(field string, value any) *Conditions
- func (cs *Conditions) Gte(field string, value any) *Conditions
- func (cs *Conditions) In(field string, values any) *Conditions
- func (cs *Conditions) IsNotNull(field string) *Conditions
- func (cs *Conditions) IsNull(field string) *Conditions
- func (cs *Conditions) Like(field string, pattern any) *Conditions
- func (cs *Conditions) Lt(field string, value any) *Conditions
- func (cs *Conditions) Lte(field string, value any) *Conditions
- func (cs *Conditions) Ne(field string, value any) *Conditions
- func (cs *Conditions) NotIn(field string, values any) *Conditions
- func (cs *Conditions) NotLike(field string, pattern any) *Conditions
- func (cs *Conditions) Or(field string, op Op, value any) *Conditions
- func (cs *Conditions) OrCustom(custom string, values []any) *Conditions
- func (cs *Conditions) OrEq(field string, value any) *Conditions
- func (cs *Conditions) OrGroup(sub *Conditions) *Conditions
- func (cs *Conditions) OrGt(field string, value any) *Conditions
- func (cs *Conditions) OrGte(field string, value any) *Conditions
- func (cs *Conditions) OrIn(field string, values any) *Conditions
- func (cs *Conditions) OrIsNotNull(field string) *Conditions
- func (cs *Conditions) OrIsNull(field string) *Conditions
- func (cs *Conditions) OrLike(field string, pattern any) *Conditions
- func (cs *Conditions) OrLt(field string, value any) *Conditions
- func (cs *Conditions) OrLte(field string, value any) *Conditions
- func (cs *Conditions) OrNe(field string, value any) *Conditions
- func (cs *Conditions) OrNotIn(field string, values any) *Conditions
- func (cs *Conditions) OrNotLike(field string, pattern any) *Conditions
- func (cs *Conditions) OrWhereSql(whereSql string, args ...any) *Conditions
- func (cs *Conditions) Where(field string, value any) *Conditions
- type Config
- type ConnProxy
- type Constraint
- type ConstraintColumn
- type DDLHandler
- type DDLOption
- func (this_ *DDLOption) IsAppendDatabaseName() bool
- func (this_ *DDLOption) IsAppendSchemaName() bool
- func (this_ *DDLOption) IsWrapConstraintName() bool
- func (this_ *DDLOption) IsWrapDatabaseName() bool
- func (this_ *DDLOption) IsWrapIndexName() bool
- func (this_ *DDLOption) IsWrapSchemaName() bool
- func (this_ *DDLOption) IsWrapSequenceName() bool
- func (this_ *DDLOption) IsWrapUserName() bool
- func (this_ *DDLOption) WrapConstraintName(name string) string
- func (this_ *DDLOption) WrapDatabaseName(name string) string
- func (this_ *DDLOption) WrapIndexName(name string) string
- func (this_ *DDLOption) WrapSchemaName(name string) string
- func (this_ *DDLOption) WrapSequenceName(name string) string
- func (this_ *DDLOption) WrapUserName(name string) string
- type Database
- type Dialect
- type DialectColumnConfig
- type DialectConfig
- func (this_ *DialectConfig) CreateUserAutoCreateDatabase() bool
- func (this_ *DialectConfig) CreateUserAutoCreateSchema() bool
- func (this_ *DialectConfig) FindFunc(name string) (r map[string]any)
- func (this_ *DialectConfig) FindType(name string) (r *DialectTypeConfig)
- func (this_ *DialectConfig) GetArgChar() string
- func (this_ *DialectConfig) GetColumnAdd() (t *SqlTemplate)
- func (this_ *DialectConfig) GetColumnComment() (t *SqlTemplate)
- func (this_ *DialectConfig) GetColumnDelete() (t *SqlTemplate)
- func (this_ *DialectConfig) GetColumnSelect() (t *SqlTemplate)
- func (this_ *DialectConfig) GetColumnUpdate() (t *SqlTemplate)
- func (this_ *DialectConfig) GetColumnUpdateDefault() (t *SqlTemplate)
- func (this_ *DialectConfig) GetColumnUpdateNotNull() (t *SqlTemplate)
- func (this_ *DialectConfig) GetColumnUpdateRename() (t *SqlTemplate)
- func (this_ *DialectConfig) GetColumnUpdateType() (t *SqlTemplate)
- func (this_ *DialectConfig) GetConstraintAdd() (t *SqlTemplate)
- func (this_ *DialectConfig) GetConstraintComment() (t *SqlTemplate)
- func (this_ *DialectConfig) GetConstraintDelete() (t *SqlTemplate)
- func (this_ *DialectConfig) GetConstraintSelect() (t *SqlTemplate)
- func (this_ *DialectConfig) GetDatabaseChange() (t *SqlTemplate)
- func (this_ *DialectConfig) GetDatabaseCreate() (t *SqlTemplate)
- func (this_ *DialectConfig) GetDatabaseCreateFieldList() (res []*Field)
- func (this_ *DialectConfig) GetDatabaseDelete() (t *SqlTemplate)
- func (this_ *DialectConfig) GetDatabaseSelect() (t *SqlTemplate)
- func (this_ *DialectConfig) GetDriver() *DialectDriverConfig
- func (this_ *DialectConfig) GetIndexAdd() (t *SqlTemplate)
- func (this_ *DialectConfig) GetIndexComment() (t *SqlTemplate)
- func (this_ *DialectConfig) GetIndexDelete() (t *SqlTemplate)
- func (this_ *DialectConfig) GetIndexSelect() (t *SqlTemplate)
- func (this_ *DialectConfig) GetNameNoWrapIsUpper() bool
- func (this_ *DialectConfig) GetNameWrapChar() string
- func (this_ *DialectConfig) GetSchemaChange() (t *SqlTemplate)
- func (this_ *DialectConfig) GetSchemaCreate() (t *SqlTemplate)
- func (this_ *DialectConfig) GetSchemaCreateFieldList() (res []*Field)
- func (this_ *DialectConfig) GetSchemaDelete() (t *SqlTemplate)
- func (this_ *DialectConfig) GetSchemaSelect() (t *SqlTemplate)
- func (this_ *DialectConfig) GetSequenceCreate() (t *SqlTemplate)
- func (this_ *DialectConfig) GetSequenceCreateFieldList() (res []*Field)
- func (this_ *DialectConfig) GetSequenceDelete() (t *SqlTemplate)
- func (this_ *DialectConfig) GetSequenceSelect() (t *SqlTemplate)
- func (this_ *DialectConfig) GetStringEscapeChar() string
- func (this_ *DialectConfig) GetStringWrapChar() string
- func (this_ *DialectConfig) GetTableCreate() (t *SqlTemplate)
- func (this_ *DialectConfig) GetTableCreateColumn() (t *SqlTemplate)
- func (this_ *DialectConfig) GetTableCreateColumnComment() (t *SqlTemplate)
- func (this_ *DialectConfig) GetTableCreateComment() (t *SqlTemplate)
- func (this_ *DialectConfig) GetTableCreateConstraint() (t *SqlTemplate)
- func (this_ *DialectConfig) GetTableCreateConstraintComment() (t *SqlTemplate)
- func (this_ *DialectConfig) GetTableCreateFieldList() (res []*Field)
- func (this_ *DialectConfig) GetTableCreateIndex() (t *SqlTemplate)
- func (this_ *DialectConfig) GetTableCreateIndexComment() (t *SqlTemplate)
- func (this_ *DialectConfig) GetTableCreateSequenceTrigger() (t *SqlTemplate)
- func (this_ *DialectConfig) GetTableDelete() (t *SqlTemplate)
- func (this_ *DialectConfig) GetTableSelect() (t *SqlTemplate)
- func (this_ *DialectConfig) GetUserChange() (t *SqlTemplate)
- func (this_ *DialectConfig) GetUserCreate() (t *SqlTemplate)
- func (this_ *DialectConfig) GetUserCreateFieldList() (res []*Field)
- func (this_ *DialectConfig) GetUserDelete() (t *SqlTemplate)
- func (this_ *DialectConfig) GetUserSelect() (t *SqlTemplate)
- func (this_ *DialectConfig) Init() (err error)
- func (this_ *DialectConfig) IsSystemDatabase(name string) bool
- func (this_ *DialectConfig) IsSystemSchema(name string) bool
- func (this_ *DialectConfig) IsSystemUser(name string) bool
- func (this_ *DialectConfig) MatchType(dataType string, length, precision, scale int) (r *DialectTypeConfig)
- func (this_ *DialectConfig) NewPlaceSqlTemplate(place string, sqlInfo string) (res *SqlTemplate, err error)
- type DialectConstraintConfig
- type DialectDatabaseConfig
- type DialectDriverConfig
- type DialectIndexConfig
- type DialectNodeConfig
- type DialectSchemaConfig
- type DialectSequenceConfig
- type DialectService
- func (this_ *DialectService) AppendParam(handler DDLHandler, param map[string]any, obj any, ignoreNames ...string)
- func (this_ *DialectService) AppendParamExtend(handler DDLHandler, param map[string]any, extend map[string]any)
- func (this_ *DialectService) AppendParamTableName(handler DDLHandler, param map[string]any, databaseName string, ...)
- func (this_ *DialectService) ArgChar() string
- func (this_ *DialectService) Column(sqlConn SqlConn, databaseName string, schemaName string, tableName string, ...) (column *Column, err error)
- func (this_ *DialectService) ColumnAdd(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, ...) (err error)
- func (this_ *DialectService) ColumnAddSql(handler DDLHandler, databaseName string, schemaName string, tableName string, ...) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) ColumnCheckExists(sqlConn SqlConn, databaseName string, schemaName string, tableName string, ...) (exists bool)
- func (this_ *DialectService) ColumnComment(handler DDLHandler, databaseName string, schemaName string, tableName string, ...) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) ColumnCommentSql(handler DDLHandler, databaseName string, schemaName string, tableName string, ...) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) ColumnDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, ...) (err error)
- func (this_ *DialectService) ColumnDeleteSql(handler DDLHandler, databaseName string, schemaName string, tableName string, ...) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) ColumnFull(sqlConn SqlConn, databaseName string, schemaName string, tableName string, ...) (err error)
- func (this_ *DialectService) ColumnList(sqlConn SqlConn, databaseName string, schemaName string, tableName string) (columnList []*Column, err error)
- func (this_ *DialectService) ColumnParam(handler DDLHandler, databaseName string, schemaName string, tableName string, ...) (param map[string]any)
- func (this_ *DialectService) ColumnSelectSql(databaseName string, schemaName string, tableName string, columnName string) (sqlInfo string, sqlArgs []any)
- func (this_ *DialectService) ColumnUpdate(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, ...) (err error)
- func (this_ *DialectService) ColumnUpdateSql(handler DDLHandler, databaseName string, schemaName string, tableName string, ...) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) Constraint(sqlConn SqlConn, databaseName string, schemaName string, tableName string, ...) (constraint *Constraint, err error)
- func (this_ *DialectService) ConstraintAdd(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, ...) (err error)
- func (this_ *DialectService) ConstraintAddSql(handler DDLHandler, databaseName string, schemaName string, tableName string, ...) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) ConstraintComment(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, ...) (err error)
- func (this_ *DialectService) ConstraintCommentSql(handler DDLHandler, databaseName string, schemaName string, tableName string, ...) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) ConstraintDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, ...) (err error)
- func (this_ *DialectService) ConstraintDeleteSql(handler DDLHandler, databaseName string, schemaName string, tableName string, ...) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) ConstraintList(sqlConn SqlConn, databaseName string, schemaName string, tableName string) (constraintList []*Constraint, err error)
- func (this_ *DialectService) ConstraintParam(handler DDLHandler, databaseName string, schemaName string, tableName string, ...) (param map[string]any)
- func (this_ *DialectService) ConstraintSelectSql(databaseName string, schemaName string, tableName string, ...) (sqlInfo string, sqlArgs []any)
- func (this_ *DialectService) Database(sqlConn SqlConn, databaseName string) (database *Database, err error)
- func (this_ *DialectService) DatabaseChange(sqlConn SqlConn, databaseName string) (ok bool, err error)
- func (this_ *DialectService) DatabaseCreate(sqlConn SqlConn, handler DDLHandler, database *Database) (err error)
- func (this_ *DialectService) DatabaseCreateFieldList() (sqlList []*Field)
- func (this_ *DialectService) DatabaseCreateSql(handler DDLHandler, database *Database) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) DatabaseDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, cascade bool) (err error)
- func (this_ *DialectService) DatabaseDeleteSql(handler DDLHandler, databaseName string, cascade bool) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) DatabaseList(sqlConn SqlConn) (databaseList []*Database, err error)
- func (this_ *DialectService) DatabaseParam(handler DDLHandler, database *Database) (param map[string]any)
- func (this_ *DialectService) DatabaseSelectSql(databaseName string) (sqlInfo string, sqlArgs []any)
- func (this_ *DialectService) EscapeStringChar() string
- func (this_ *DialectService) Exec(sqlConn SqlConn, sqlInfo string, sqlArgs []any) (err error)
- func (this_ *DialectService) Execs(sqlConn SqlConn, sqlList []string, sqlArgsList [][]any) (err error)
- func (this_ *DialectService) FormatPageSql(sqlInfo string, pageSize int64, pageNo int64) (res string)
- func (this_ *DialectService) FormatSqlArgChar(sqlInfo string) (res string)
- func (this_ *DialectService) GetColumnDefault(handler DDLHandler, column *Column) (res string)
- func (this_ *DialectService) GetColumnType(handler DDLHandler, column *Column) (columnType string)
- func (this_ *DialectService) GetDDLHandler(handler DDLHandler) DDLHandler
- func (this_ *DialectService) GetDriverDSN(dbCfg *Config, params map[string]string) string
- func (this_ *DialectService) GetDriverName() string
- func (this_ *DialectService) GetParam(handler DDLHandler, obj any) (param map[string]any)
- func (this_ *DialectService) Index(sqlConn SqlConn, databaseName string, schemaName string, tableName string, ...) (index *Index, err error)
- func (this_ *DialectService) IndexAdd(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, ...) (err error)
- func (this_ *DialectService) IndexAddSql(handler DDLHandler, databaseName string, schemaName string, tableName string, ...) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) IndexCheckExists(sqlConn SqlConn, databaseName string, schemaName string, tableName string, ...) (exists bool)
- func (this_ *DialectService) IndexComment(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, ...) (err error)
- func (this_ *DialectService) IndexCommentSql(handler DDLHandler, databaseName string, schemaName string, tableName string, ...) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) IndexDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, ...) (err error)
- func (this_ *DialectService) IndexDeleteSql(handler DDLHandler, databaseName string, schemaName string, tableName string, ...) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) IndexList(sqlConn SqlConn, databaseName string, schemaName string, tableName string) (indexList []*Index, err error)
- func (this_ *DialectService) IndexParam(handler DDLHandler, databaseName string, schemaName string, tableName string, ...) (param map[string]any)
- func (this_ *DialectService) IndexSelectSql(databaseName string, schemaName string, tableName string, indexName string) (sqlInfo string, sqlArgs []any)
- func (this_ *DialectService) Info() (info *Info)
- func (this_ *DialectService) IsAppendDatabaseName() bool
- func (this_ *DialectService) IsAppendSchemaName() bool
- func (this_ *DialectService) Match() []string
- func (this_ *DialectService) Names(names ...string) (res string)
- func (this_ *DialectService) Open(dbCfg *Config, params map[string]string) (sqlDb *sql.DB, err error)
- func (this_ *DialectService) Query(sqlConn SqlConn, sqlInfo string, sqlArgs []any) (res []map[string]any, err error)
- func (this_ *DialectService) QueryOne(sqlConn SqlConn, sqlInfo string, sqlArgs []any) (res map[string]any, err error)
- func (this_ *DialectService) Schema(sqlConn SqlConn, databaseName string, schemaName string) (schema *Schema, err error)
- func (this_ *DialectService) SchemaChange(sqlConn SqlConn, schemaName string) (ok bool, err error)
- func (this_ *DialectService) SchemaCreate(sqlConn SqlConn, handler DDLHandler, databaseName string, schema *Schema) (err error)
- func (this_ *DialectService) SchemaCreateFieldList() (sqlList []*Field)
- func (this_ *DialectService) SchemaCreateSql(handler DDLHandler, databaseName string, schema *Schema) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) SchemaDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, ...) (err error)
- func (this_ *DialectService) SchemaDeleteSql(handler DDLHandler, databaseName string, schemaName string, cascade bool) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) SchemaList(sqlConn SqlConn, databaseName string) (schemaList []*Schema, err error)
- func (this_ *DialectService) SchemaParam(handler DDLHandler, databaseName string, schema *Schema) (param map[string]any)
- func (this_ *DialectService) SchemaSelectSql(databaseName string, schemaName string) (sqlInfo string, sqlArgs []any)
- func (this_ *DialectService) Sequence(sqlConn SqlConn, databaseName string, schemaName string, sequenceName string) (sequence *Sequence, err error)
- func (this_ *DialectService) SequenceCreate(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, ...) (err error)
- func (this_ *DialectService) SequenceCreateFieldList() (sqlList []*Field)
- func (this_ *DialectService) SequenceCreateSql(handler DDLHandler, databaseName string, schemaName string, sequence *Sequence) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) SequenceDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, ...) (err error)
- func (this_ *DialectService) SequenceDeleteSql(handler DDLHandler, databaseName string, schemaName string, ...) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) SequenceList(sqlConn SqlConn, databaseName string, schemaName string) (sequenceList []*Sequence, err error)
- func (this_ *DialectService) SequenceParam(handler DDLHandler, databaseName string, schemaName string, sequence *Sequence) (param map[string]any)
- func (this_ *DialectService) SequenceSelectSql(databaseName string, schemaName string, sequenceName string) (sqlInfo string, sqlArgs []any)
- func (this_ *DialectService) SqlConcat(args ...string) (res string)
- func (this_ *DialectService) Table(sqlConn SqlConn, databaseName string, schemaName string, tableName string) (table *Table, err error)
- func (this_ *DialectService) TableCheckExists(sqlConn SqlConn, databaseName string, schemaName string, tableName string) (exists bool)
- func (this_ *DialectService) TableCreate(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, ...) (err error)
- func (this_ *DialectService) TableCreateFieldList() (sqlList []*Field)
- func (this_ *DialectService) TableCreateSql(handler DDLHandler, databaseName string, schemaName string, table *Table) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) TableDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, ...) (err error)
- func (this_ *DialectService) TableDeleteSql(handler DDLHandler, databaseName string, schemaName string, tableName string) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) TableDetail(sqlConn SqlConn, databaseName string, schemaName string, tableName string) (table *Table, err error)
- func (this_ *DialectService) TableDetailList(sqlConn SqlConn, databaseName string, schemaName string) (tableList []*Table, err error)
- func (this_ *DialectService) TableList(sqlConn SqlConn, databaseName string, schemaName string) (tableList []*Table, err error)
- func (this_ *DialectService) TableParam(handler DDLHandler, databaseName string, schemaName string, table *Table) (param map[string]any)
- func (this_ *DialectService) TableSelectSql(databaseName string, schemaName string, tableName string) (sqlInfo string, sqlArgs []any)
- func (this_ *DialectService) TemplateSql(t *SqlTemplate, param map[string]any) (sqlInfo string, sqlArgs []any)
- func (this_ *DialectService) TemplateSqlList(t *SqlTemplate, param map[string]any) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) Type() string
- func (this_ *DialectService) User(sqlConn SqlConn, userName string) (user *User, err error)
- func (this_ *DialectService) UserChange(sqlConn SqlConn, userName string, password string) (ok bool, err error)
- func (this_ *DialectService) UserCreate(sqlConn SqlConn, handler DDLHandler, user *User) (err error)
- func (this_ *DialectService) UserCreateFieldList() (sqlList []*Field)
- func (this_ *DialectService) UserCreateSql(handler DDLHandler, user *User) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) UserDelete(sqlConn SqlConn, handler DDLHandler, userName string) (err error)
- func (this_ *DialectService) UserDeleteSql(handler DDLHandler, userName string) (sqlList []string, sqlArgsList [][]any)
- func (this_ *DialectService) UserList(sqlConn SqlConn) (userList []*User, err error)
- func (this_ *DialectService) UserParam(handler DDLHandler, user *User) (param map[string]any)
- func (this_ *DialectService) UserSelectSql(userName string) (sqlInfo string, sqlArgs []any)
- func (this_ *DialectService) WrapColumnName(name string) string
- func (this_ *DialectService) WrapConstraintName(name string) string
- func (this_ *DialectService) WrapDatabaseName(name string) string
- func (this_ *DialectService) WrapIndexName(name string) string
- func (this_ *DialectService) WrapName(name string) (res string)
- func (this_ *DialectService) WrapNameChar() string
- func (this_ *DialectService) WrapNames(wrapName func(name string) (res string), names ...string) (res string)
- func (this_ *DialectService) WrapSchemaName(name string) string
- func (this_ *DialectService) WrapSequenceName(name string) string
- func (this_ *DialectService) WrapString(str string) (res string)
- func (this_ *DialectService) WrapStringChar() string
- func (this_ *DialectService) WrapTableName(name string) string
- func (this_ *DialectService) WrapUserName(name string) string
- type DialectTableConfig
- type DialectTypeConfig
- type DialectUserConfig
- type DmBlobType
- type DmClobType
- type Field
- type FieldSetterType
- type FiledGetColumn
- type FiledGetValue
- type Form
- type GetSqlValueType
- type HasStringFuncType
- type IDynamicService
- type IGetObjectField
- type IGetPrimaryKey
- type IGetSql
- type IGetTableName
- type IModel
- type IModelSql
- type IService
- type IncludedPlace
- type Index
- type IndexColumn
- type Info
- type InsertOrUpdateValue
- type ModelCount
- type ModelCountSet
- type ModelDelete
- func (this_ *ModelDelete) CanDeleteAll() *ModelDelete
- func (this_ *ModelDelete) Exec(ctx context.Context) (res sql.Result, err error)
- func (this_ *ModelDelete) GetSql() (sqlInfo string, args []any, err error)
- func (this_ *ModelDelete) SetWhere(where *Conditions) *ModelDelete
- func (this_ *ModelDelete) Where() *Conditions
- type ModelDeleteSet
- type ModelField
- type ModelInfo
- type ModelInsert
- type ModelInsertSet
- type ModelOption
- func (this_ *ModelOption) GetColumnValue(modelV reflect.Value, columnName string) (fieldValue *util.FieldValue)
- func (this_ *ModelOption) GetColumnValues(modelV reflect.Value) (columns []string, values []*util.FieldValue)
- func (this_ *ModelOption) GetColumns(modelV reflect.Value) (columns []string)
- func (this_ *ModelOption) GetModelInfo(inType reflect.Type) (info *ModelInfo)
- func (this_ *ModelOption) SetGetColumn(getColumn FiledGetColumn) *ModelOption
- func (this_ *ModelOption) SetGetValue(getValue FiledGetValue) *ModelOption
- type ModelSelect
- type ModelSelectSet
- type ModelSetting
- func (this_ *ModelSetting) AppendSql(appendSql string, appendArgs ...any) *ModelSetting
- func (this_ *ModelSetting) EmptySelectExclude() *ModelSetting
- func (this_ *ModelSetting) EmptySelectInclude() *ModelSetting
- func (this_ *ModelSetting) EmptyUseNull() *ModelSetting
- func (this_ *ModelSetting) EmptyValueExclude() *ModelSetting
- func (this_ *ModelSetting) EmptyValueInclude() *ModelSetting
- func (this_ *ModelSetting) EmptyWhereExclude() *ModelSetting
- func (this_ *ModelSetting) EmptyWhereInclude() *ModelSetting
- func (this_ *ModelSetting) GetAppendSql() (appendSql string, appendArgs []any)
- func (this_ *ModelSetting) GetModelAndWhereSql(b *OrmSqlBuilder, model any, where *Conditions) (whereSql string, whereArgs []any)
- func (this_ *ModelSetting) GetPrimaryKey(model any) []string
- func (this_ *ModelSetting) GetService() IService
- func (this_ *ModelSetting) GetTableName(model any) string
- func (this_ *ModelSetting) GetValue(columnValue *util.FieldValue) (isNull bool, res any)
- func (this_ *ModelSetting) IncludeEmpty() *ModelSetting
- func (this_ *ModelSetting) IncludeNull() *ModelSetting
- func (this_ *ModelSetting) IncludeZero() *ModelSetting
- func (this_ *ModelSetting) Included(place IncludedPlace, columnName string, columnValue *util.FieldValue) bool
- func (this_ *ModelSetting) IsSelectExclude(column string) bool
- func (this_ *ModelSetting) IsSelectInclude(column string) bool
- func (this_ *ModelSetting) IsValueExclude(column string) bool
- func (this_ *ModelSetting) IsValueInclude(column string) bool
- func (this_ *ModelSetting) IsWhereExclude(column string) bool
- func (this_ *ModelSetting) IsWhereInclude(column string) bool
- func (this_ *ModelSetting) NewBuilder(model any) (res *OrmSqlBuilder)
- func (this_ *ModelSetting) SelectExclude(columns ...string) *ModelSetting
- func (this_ *ModelSetting) SelectInclude(columns ...string) *ModelSetting
- func (this_ *ModelSetting) SetModelOption(modelOption *ModelOption) *ModelSetting
- func (this_ *ModelSetting) SetPrimaryKey(columns ...string) *ModelSetting
- func (this_ *ModelSetting) SetService(service *Service) *ModelSetting
- func (this_ *ModelSetting) SetSqlHandler(sqlHandler SqlHandler) *ModelSetting
- func (this_ *ModelSetting) SetTableName(tableName string) *ModelSetting
- func (this_ *ModelSetting) ValueExclude(columns ...string) *ModelSetting
- func (this_ *ModelSetting) ValueInclude(columns ...string) *ModelSetting
- func (this_ *ModelSetting) WhereExclude(columns ...string) *ModelSetting
- func (this_ *ModelSetting) WhereInclude(columns ...string) *ModelSetting
- func (this_ *ModelSetting) WhereOperator(column string, op string) *ModelSetting
- func (this_ *ModelSetting) ZeroUseNull() *ModelSetting
- type ModelUpdate
- func (this_ *ModelUpdate) CanUpdateAll() *ModelUpdate
- func (this_ *ModelUpdate) Exec(ctx context.Context) (res sql.Result, err error)
- func (this_ *ModelUpdate) GetSql() (sqlInfo string, args []any, err error)
- func (this_ *ModelUpdate) SetWhere(where *Conditions) *ModelUpdate
- func (this_ *ModelUpdate) Where() *Conditions
- type ModelUpdateSet
- type Op
- type OrmSqlBuilder
- type ReadExpression
- type ReadScope
- type ReadState
- type ReadText
- type Schema
- type Sequence
- type Service
- func (this_ *Service) AddColumn(tableName string, column *Column) (err error)
- func (this_ *Service) CheckColumnExist(tableName string, columnName string) (res bool)
- func (this_ *Service) CheckIndexExist(tableName string, checkIndex *Index) (res bool)
- func (this_ *Service) CheckTableExist(tableName string) (res bool)
- func (this_ *Service) Close()
- func (this_ *Service) CloseShowExecSql() *Service
- func (this_ *Service) CloseShowQuerySql() *Service
- func (this_ *Service) Count(ctx context.Context, model IModel, sets ...ModelCountSet) (res int64, err error)
- func (this_ *Service) CreateIndex(tableName string, index *Index) (err error)
- func (this_ *Service) CreateTable(table *Table) (err error)
- func (this_ *Service) Delete(ctx context.Context, model IModel, sets ...ModelDeleteSet) (res sql.Result, err error)
- func (this_ *Service) Exec(ctx context.Context, sqlInfo string, args []any) (res sql.Result, err error)
- func (this_ *Service) Execs(ctx context.Context, sqlList []string, argsList [][]any) (results []sql.Result, err error)
- func (this_ *Service) GetConfig() Config
- func (this_ *Service) GetDDLHandler() (handler DDLHandler)
- func (this_ *Service) GetDatabaseName() string
- func (this_ *Service) GetDialect() Dialect
- func (this_ *Service) GetModelOption() (modelOption *ModelOption)
- func (this_ *Service) GetSchemaName() string
- func (this_ *Service) GetSqlConn() SqlConn
- func (this_ *Service) GetSqlHandler() (handler SqlHandler)
- func (this_ *Service) GetSqlValue() GetSqlValueType
- func (this_ *Service) Insert(ctx context.Context, model IModel, sets ...ModelInsertSet) (res sql.Result, err error)
- func (this_ *Service) ModelCount(model any, sets ...ModelCountSet) (res *ModelCount)
- func (this_ *Service) ModelDelete(model any, sets ...ModelDeleteSet) (res *ModelDelete)
- func (this_ *Service) ModelInsert(model any, sets ...ModelInsertSet) (res *ModelInsert)
- func (this_ *Service) ModelSelect(model any, sets ...ModelSelectSet) (res *ModelSelect)
- func (this_ *Service) ModelUpdate(model any, sets ...ModelUpdateSet) (res *ModelUpdate)
- func (this_ *Service) OpenShowExecSql() *Service
- func (this_ *Service) OpenShowQuerySql() *Service
- func (this_ *Service) QueryCount(ctx context.Context, sqlInfo string, args []any) (count int64, err error)
- func (this_ *Service) QueryMapList(ctx context.Context, sqlInfo string, args []any) (list []map[string]any, err error)
- func (this_ *Service) QueryMapOne(ctx context.Context, sqlInfo string, args []any) (one map[string]any, err error)
- func (this_ *Service) QueryMapPage(ctx context.Context, sqlInfo string, args []any, pageSize int64, pageNo int64) (list []map[string]any, err error)
- func (this_ *Service) RealService(param *SqlParam, tableName string) IService
- func (this_ *Service) RealTableName(param *SqlParam, tableName string) (realTableName string)
- func (this_ *Service) SetDDLHandler(handler DDLHandler)
- func (this_ *Service) SetDynamicService(dynamicService IDynamicService)
- func (this_ *Service) SetFieldValue() SetFieldValueType
- func (this_ *Service) SetGetSqlValue(getSqlValue GetSqlValueType)
- func (this_ *Service) SetModelOption(modelOption *ModelOption)
- func (this_ *Service) SetSetFieldValue(setFieldValue SetFieldValueType)
- func (this_ *Service) SetSqlHandler(handler SqlHandler)
- func (this_ *Service) ShowExecSql() bool
- func (this_ *Service) ShowQuerySql() bool
- func (this_ *Service) SqlCount(table string, sets ...SqlCountSet) (res *SqlCount)
- func (this_ *Service) SqlDelete(table string, sets ...SqlDeleteSet) (res *SqlDelete)
- func (this_ *Service) SqlInsert(table string, sets ...SqlInsertSet) (res *SqlInsert)
- func (this_ *Service) SqlSelect(table string, columns ...string) (res *SqlSelect)
- func (this_ *Service) SqlUpdate(table string, sets ...SqlUpdateSet) (res *SqlUpdate)
- func (this_ *Service) Update(ctx context.Context, model IModel, sets ...ModelUpdateSet) (res sql.Result, err error)
- func (this_ *Service) WrapColumnName(param *SqlParam, columnName string) (wrapColumnName string)
- func (this_ *Service) WrapTableName(param *SqlParam, tableName string) (wrapTableName string)
- type SetFieldValueType
- type SqlBuilder
- type SqlConcatValue
- type SqlConfiguration
- type SqlConfigurationSet
- type SqlConn
- type SqlCount
- type SqlCountSet
- type SqlDelete
- func (this_ *SqlDelete) CanDeleteAll() *SqlDelete
- func (this_ *SqlDelete) Exec(ctx context.Context) (res sql.Result, err error)
- func (this_ *SqlDelete) GetSql() (sqlInfo string, args []any, err error)
- func (this_ *SqlDelete) SetWhere(where *Conditions) *SqlDelete
- func (this_ *SqlDelete) Where() *Conditions
- type SqlDeleteSet
- type SqlExpression
- type SqlHandler
- type SqlInsert
- type SqlInsertSet
- type SqlNode
- type SqlNodeArgParam
- type SqlNodeArithmeticOperate
- type SqlNodeBlock
- type SqlNodeComment
- type SqlNodeDDL
- type SqlNodeDelete
- type SqlNodeDotExpression
- type SqlNodeElse
- type SqlNodeElseIf
- type SqlNodeFloat
- type SqlNodeIdentifier
- type SqlNodeIf
- type SqlNodeInsert
- type SqlNodeInt
- type SqlNodeLogicalOperate
- type SqlNodeOptional
- type SqlNodeParam
- type SqlNodeParenthesis
- type SqlNodeRelationalOperate
- type SqlNodeSelect
- type SqlNodeSql
- type SqlNodeString
- type SqlNodeTernary
- type SqlNodeText
- type SqlNodeUpdate
- type SqlOption
- func (this_ *SqlOption) RealTableName(param *SqlParam, tableName string) (realTableName string)
- func (this_ *SqlOption) Set(fn func(o *SqlOption)) *SqlOption
- func (this_ *SqlOption) WrapColumnName(param *SqlParam, columnName string) (wrapColumnName string)
- func (this_ *SqlOption) WrapTableName(param *SqlParam, tableName string) (wrapTableName string)
- type SqlParam
- func (this_ *SqlParam) FindParam(name string) (v any, find bool)
- func (this_ *SqlParam) GetData() any
- func (this_ *SqlParam) GetObjectField(obj any, name string) (res any)
- func (this_ *SqlParam) GetParam(name string) (res any)
- func (this_ *SqlParam) GetStringParam(name string) (res string)
- func (this_ *SqlParam) Set(name string, value any) *SqlParam
- type SqlParamParser
- func (this_ *SqlParamParser) Append(sql string, param any) *SqlParamParser
- func (this_ *SqlParamParser) GetParamData(param any) (data map[string]any)
- func (this_ *SqlParamParser) Parse() (res string, args []any, err error)
- func (this_ *SqlParamParser) ParseInfo() (info *SqlParamParserInfo, err error)
- type SqlParamParserInfo
- type SqlReader
- type SqlSelect
- type SqlTemplate
- func (this_ *SqlTemplate) Append(sqlList ...string) *SqlTemplate
- func (this_ *SqlTemplate) GetSql(handler SqlHandler, param map[string]any) (sqlInfo string, sqlArgs []any)
- func (this_ *SqlTemplate) GetSqlHandler() SqlHandler
- func (this_ *SqlTemplate) GetSqlList(handler SqlHandler, param map[string]any) (sqlList []string, sqlArgsList [][]any)
- func (this_ *SqlTemplate) GetTemplateSql() (str string)
- func (this_ *SqlTemplate) Parse() (err error)
- func (this_ *SqlTemplate) ParseSql(r *SqlReader) (res *SqlNodeSql, err error)
- func (this_ *SqlTemplate) ParseSqlList(str string) (res []*SqlNodeSql, err error)
- func (this_ *SqlTemplate) SetSqlHandler(sqlHandler SqlHandler) *SqlTemplate
- type SqlUpdate
- func (this_ *SqlUpdate) CanUpdateAll() *SqlUpdate
- func (this_ *SqlUpdate) Exec(ctx context.Context) (res sql.Result, err error)
- func (this_ *SqlUpdate) GetSql() (sqlInfo string, args []any, err error)
- func (this_ *SqlUpdate) SetWhere(where *Conditions) *SqlUpdate
- func (this_ *SqlUpdate) Value(column string, value any) *SqlUpdate
- func (this_ *SqlUpdate) Where() *Conditions
- type SqlUpdateSet
- type StringType
- type Table
- type User
- type WhereOperator
- type WrapOption
- func (this_ WrapOption) IsWrapColumnName() bool
- func (this_ WrapOption) IsWrapName() bool
- func (this_ WrapOption) IsWrapTableName() bool
- func (this_ WrapOption) Names(names []string) (res string)
- func (this_ WrapOption) Set(fn func(o WrapOption)) WrapOption
- func (this_ WrapOption) WrapColumnName(name string) string
- func (this_ WrapOption) WrapName(name string) (res string)
- func (this_ WrapOption) WrapNames(names []string) (res string)
- func (this_ WrapOption) WrapString(str string) (res string)
- func (this_ WrapOption) WrapTableName(name string) string
Constants ¶
This section is empty.
Variables ¶
var ( SqlParamParserDefaultParamBefore = "\\${" SqlParamParserDefaultParamAfter = "}" )
var (
DefaultModelOption = NewModelOption()
)
var (
DefaultSqlOption = NewSqlOption()
)
var (
ErrorHasMoreRows = errors.New("has more rows by query one")
)
var (
ErrorNotSupportCreateTable = errors.New("not support create table")
)
var IncludedPlaceValue = IncludedPlace(1)
var IncludedPlaceWhere = IncludedPlace(2)
Functions ¶
func AddDialectByConfigDir ¶
func AddDialectByConfigFile ¶
func DoExecBatch ¶
func DoQueryCount ¶
func DoQueryListStruct ¶
func DoQueryListWithModel ¶
func DoQueryListWithSql ¶
func DoQueryOne ¶
func DoQueryOneStruct ¶
func DoQueryOneWithModel ¶
func DoQueryOneWithSql ¶
func DoQueryPageWithModel ¶
func DoQueryPageWithSql ¶
func DoQueryWithColumnTypes ¶
func FormatColumnType ¶
func FormatDriverDSN ¶
func GetBaseTypeValue ¶
func GetInsertOrUpdateColumnValues ¶
func GetInsertOrUpdateColumnValues(list []*InsertOrUpdateValue) (columns []string, values []*util.FieldValue)
func GetParamValue ¶
func GetSqlValue ¶
func GetSqlValue(columnType *sql.ColumnType, data any) (value any)
func GetStringValue ¶
func HasNewLine ¶
func IsWhiteSpace(char string) bool {
switch char {
case " ", "\t", "\v", "\u00a0", "'\ufeff'":
return true
case "\n", "\r":
return true
}
return false
}
func IsIdentifier ¶
func IsInt64Value ¶
func IsWhiteSpace ¶
func ParserToFormat ¶
ParserToFormat 解析 字符串参数 将 `xx{name}xx{xx}` 转为 `xx{0}xx{1}` 如:{user}:{password}@tcp({host}:{port})/{database}?charset=utf8&parseTime=true&{urlParams}
func SqlTemplateHasContent ¶
func SqlTemplateHasContent(t *SqlTemplate) bool
func TableColumnAdd ¶
func TableColumnDrop ¶
func TableCreate ¶
func TableIndexAdd ¶
func TableIndexDrop ¶
func ToInt64Value ¶
func ToIntValue ¶
func ToKeyValueParams ¶
func ToUrlParams ¶
Types ¶
type ChangeSqlReader ¶
type ChangeSqlReader func(r *SqlReader)
type Column ¶
type Column struct {
DatabaseName string `json:"databaseName,omitempty"`
SchemaName string `json:"schemaName,omitempty"`
TableName string `json:"tableName,omitempty"`
Name string `json:"name,omitempty"`
Comment string `json:"comment,omitempty"`
Type string `json:"type,omitempty"`
DataType string `json:"dataType,omitempty"`
Default string `json:"default,omitempty"`
Length int `json:"length,omitempty"`
Precision int `json:"precision,omitempty"`
Scale int `json:"scale,omitempty"`
Key bool `json:"key,omitempty"`
AutoIncrement bool `json:"autoIncrement,omitempty"`
AutoIncrementStart int64 `json:"autoIncrementStart,omitempty"`
AutoIncrementName string `json:"autoIncrementName,omitempty"`
AutoIncrementCreate bool `json:"autoIncrementCreate,omitempty"`
NotNull bool `json:"notNull,omitempty"`
// 扩展属性
Extend map[string]any `json:"extend,omitempty"`
}
func ColumnByMap ¶
type Condition ¶
type Condition struct {
WhereSql string
Args []any
Field string
Op Op
Value any
// 用于嵌套的子条件(AND/OR 组)
Children *Conditions
IsOr bool // true 表示 OR 组,false 表示 AND 组(仅在有Children时有效)
}
Condition 表示一个条件(字段 + 操作符 + 值)
type Conditions ¶
type Conditions []*Condition
func NewConditions ¶
func NewConditions() *Conditions
func (*Conditions) And ¶
func (cs *Conditions) And(field string, op Op, value any) *Conditions
And 添加 AND 条件(最常用)
func (*Conditions) AndGroup ¶
func (cs *Conditions) AndGroup(sub *Conditions) *Conditions
AndGroup 添加一组 AND 条件(嵌套)
func (*Conditions) AndWhereSql ¶
func (cs *Conditions) AndWhereSql(whereSql string, args ...any) *Conditions
func (*Conditions) Build ¶
func (cs *Conditions) Build(b *OrmSqlBuilder, s IService) (string, []any)
Build 构建 WHERE 子句和参数 返回:WHERE 字符串(不含 "WHERE" 关键字),参数切片
func (*Conditions) Custom ¶
func (cs *Conditions) Custom(custom string, values []any) *Conditions
func (*Conditions) Eq ¶
func (cs *Conditions) Eq(field string, value any) *Conditions
func (*Conditions) Gt ¶
func (cs *Conditions) Gt(field string, value any) *Conditions
func (*Conditions) Gte ¶
func (cs *Conditions) Gte(field string, value any) *Conditions
func (*Conditions) In ¶
func (cs *Conditions) In(field string, values any) *Conditions
func (*Conditions) IsNotNull ¶
func (cs *Conditions) IsNotNull(field string) *Conditions
func (*Conditions) IsNull ¶
func (cs *Conditions) IsNull(field string) *Conditions
func (*Conditions) Like ¶
func (cs *Conditions) Like(field string, pattern any) *Conditions
func (*Conditions) Lt ¶
func (cs *Conditions) Lt(field string, value any) *Conditions
func (*Conditions) Lte ¶
func (cs *Conditions) Lte(field string, value any) *Conditions
func (*Conditions) Ne ¶
func (cs *Conditions) Ne(field string, value any) *Conditions
func (*Conditions) NotIn ¶
func (cs *Conditions) NotIn(field string, values any) *Conditions
func (*Conditions) NotLike ¶
func (cs *Conditions) NotLike(field string, pattern any) *Conditions
func (*Conditions) Or ¶
func (cs *Conditions) Or(field string, op Op, value any) *Conditions
Or 添加 OR 条件(单条件)
func (*Conditions) OrCustom ¶
func (cs *Conditions) OrCustom(custom string, values []any) *Conditions
func (*Conditions) OrEq ¶
func (cs *Conditions) OrEq(field string, value any) *Conditions
func (*Conditions) OrGroup ¶
func (cs *Conditions) OrGroup(sub *Conditions) *Conditions
OrGroup 添加一组 OR 条件(嵌套)
func (*Conditions) OrGt ¶
func (cs *Conditions) OrGt(field string, value any) *Conditions
func (*Conditions) OrGte ¶
func (cs *Conditions) OrGte(field string, value any) *Conditions
func (*Conditions) OrIn ¶
func (cs *Conditions) OrIn(field string, values any) *Conditions
func (*Conditions) OrIsNotNull ¶
func (cs *Conditions) OrIsNotNull(field string) *Conditions
func (*Conditions) OrIsNull ¶
func (cs *Conditions) OrIsNull(field string) *Conditions
func (*Conditions) OrLike ¶
func (cs *Conditions) OrLike(field string, pattern any) *Conditions
func (*Conditions) OrLt ¶
func (cs *Conditions) OrLt(field string, value any) *Conditions
func (*Conditions) OrLte ¶
func (cs *Conditions) OrLte(field string, value any) *Conditions
func (*Conditions) OrNe ¶
func (cs *Conditions) OrNe(field string, value any) *Conditions
func (*Conditions) OrNotIn ¶
func (cs *Conditions) OrNotIn(field string, values any) *Conditions
func (*Conditions) OrNotLike ¶
func (cs *Conditions) OrNotLike(field string, pattern any) *Conditions
func (*Conditions) OrWhereSql ¶
func (cs *Conditions) OrWhereSql(whereSql string, args ...any) *Conditions
func (*Conditions) Where ¶
func (cs *Conditions) Where(field string, value any) *Conditions
Where 快捷方式,等价于 And(field, Eq, value)
type Config ¶
type Config struct {
// Disabled 禁用 上层 初始化服务时候 可以判断该属性 如果为 配置 true 则不去初始化服务
Disabled bool `json:"disabled,omitempty" yaml:"disabled,omitempty"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
DialectType string `json:"dialectType,omitempty" yaml:"dialectType,omitempty"`
Host string `json:"host,omitempty" yaml:"host,omitempty"`
Port int `json:"port,omitempty" yaml:"port,omitempty"`
Address string `json:"address,omitempty" yaml:"address,omitempty"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
Password string `json:"password,omitempty" yaml:"password,omitempty"`
Database string `json:"database,omitempty" yaml:"database,omitempty"`
Schema string `json:"schema,omitempty" yaml:"schema,omitempty"`
DatabasePath string `json:"databasePath,omitempty" yaml:"databasePath,omitempty"`
ServerName string `json:"serverName,omitempty" yaml:"serverName,omitempty"`
Dsn string `json:"dsn,omitempty" yaml:"dsn,omitempty"`
DsnAppend string `json:"dsnAppend,omitempty" yaml:"dsnAppend,omitempty"`
MaxIdleConn int `json:"maxIdleConn,omitempty" yaml:"maxIdleConn,omitempty"`
MaxOpenConn int `json:"maxOpenConn,omitempty" yaml:"maxOpenConn,omitempty"`
TlsConfig string `json:"tlsConfig,omitempty" yaml:"tlsConfig,omitempty"`
TlsRootCert string `json:"tlsRootCert,omitempty" yaml:"tlsRootCert,omitempty"`
TlsClientCert string `json:"tlsClientCert,omitempty" yaml:"tlsClientCert,omitempty"`
TlsClientKey string `json:"tlsClientKey,omitempty" yaml:"tlsClientKey,omitempty"`
// contains filtered or unexported fields
}
func (*Config) GetConnProxy ¶
func (*Config) SetConnProxy ¶
func (*Config) SetGetDatabasePath ¶
type Constraint ¶
type Constraint struct {
DatabaseName string `json:"databaseName,omitempty"`
SchemaName string `json:"schemaName,omitempty"`
TableName string `json:"tableName,omitempty"`
Name string `json:"name,omitempty"`
Comment string `json:"comment,omitempty"`
Type string `json:"type,omitempty"`
ColumnNames []string `json:"columnNames,omitempty"`
// 引用表所在库
ReferencedDatabaseName string `json:"referencedDatabaseName,omitempty"`
// 引用表
ReferencedTableName string `json:"referencedTableName,omitempty"`
// 引用字段
ReferencedColumnNames []string `json:"referencedColumnNames,omitempty"`
IsPrimary bool `json:"isPrimary,omitempty"`
IsUnique bool `json:"isUnique,omitempty"`
IsForeign bool `json:"isForeign,omitempty"`
// 扩展属性
Extend map[string]any `json:"extend,omitempty"`
// contains filtered or unexported fields
}
func ConstraintListByColumns ¶
func ConstraintListByColumns(columns []*ConstraintColumn) (res []*Constraint)
func (*Constraint) GenName ¶
func (this_ *Constraint) GenName(databaseName string, schemaName string, tableName string) string
func (*Constraint) Init ¶
func (this_ *Constraint) Init(handler DDLHandler, databaseName string, schemaName string, tableName string)
type ConstraintColumn ¶
type ConstraintColumn struct {
DatabaseName string `json:"databaseName,omitempty"`
SchemaName string `json:"schemaName,omitempty"`
TableName string `json:"tableName,omitempty"`
Name string `json:"name,omitempty"`
Comment string `json:"comment,omitempty"`
Type string `json:"type,omitempty"`
ColumnName string `json:"columnName,omitempty"`
ColumnOrder int `json:"columnOrder,omitempty"`
// 引用表所在库
ReferencedDatabaseName string `json:"referencedDatabaseName,omitempty"`
// 引用表
ReferencedTableName string `json:"referencedTableName,omitempty"`
// 引用字段
ReferencedColumnName string `json:"referencedColumnName,omitempty"`
// 扩展属性
Extend map[string]any `json:"extend,omitempty"`
}
func ConstraintColumnByMap ¶
func ConstraintColumnByMap(data map[string]any) (res *ConstraintColumn)
type DDLHandler ¶
type DDLHandler interface {
WrapUserName(userName string) (res string)
IsAppendDatabaseName() (res bool)
WrapDatabaseName(databaseName string) (res string)
IsAppendSchemaName() (res bool)
WrapSchemaName(schemaName string) (res string)
WrapTableName(tableName string) (res string)
WrapColumnName(columnName string) (res string)
WrapConstraintName(constraintName string) (res string)
WrapIndexName(indexName string) (res string)
WrapSequenceName(sequenceName string) (res string)
WrapName(name string) (res string)
WrapString(str string) (res string)
}
type DDLOption ¶
type DDLOption struct {
WrapOption
// 是否 包装 用户名称 该配置 > NameWrap
WrapUserNameOpen *bool `json:"wrapUserNameOpen,omitempty"`
// 是否 包装 数据库名称 该配置 > NameWrap
WrapDatabaseNameOpen *bool `json:"wrapDatabaseNameOpen,omitempty"`
// 是否 包装 模式名称 该配置 > NameWrap
WrapSchemaNameOpen *bool `json:"wrapSchemaNameOpen,omitempty"`
// 是否 包装 约束名称 该配置 > NameWrap
WrapConstraintNameOpen *bool `json:"wrapConstraintNameOpen,omitempty"`
// 是否 包装 索引名称 该配置 > NameWrap
WrapIndexNameOpen *bool `json:"wrapIndexNameOpen,omitempty"`
// 是否 包装 序列名称 该配置 > NameWrap
WrapSequenceNameOpen *bool `json:"wrapSequenceNameOpen,omitempty"`
// 是否 追加 库名
AppendDatabaseName *bool `json:"appendDatabaseName,omitempty"`
// 是否 追加 模式名
AppendSchemaName *bool `json:"appendSchemaName,omitempty"`
}
func NewDDLOption ¶
func NewDDLOption() (res *DDLOption)
func (*DDLOption) IsAppendDatabaseName ¶
func (*DDLOption) IsAppendSchemaName ¶
func (*DDLOption) IsWrapConstraintName ¶
func (*DDLOption) IsWrapDatabaseName ¶
func (*DDLOption) IsWrapIndexName ¶
func (*DDLOption) IsWrapSchemaName ¶
func (*DDLOption) IsWrapSequenceName ¶
func (*DDLOption) IsWrapUserName ¶
func (*DDLOption) WrapConstraintName ¶
func (*DDLOption) WrapDatabaseName ¶
func (*DDLOption) WrapIndexName ¶
func (*DDLOption) WrapSchemaName ¶
func (*DDLOption) WrapSequenceName ¶
func (*DDLOption) WrapUserName ¶
type Database ¶
type Database struct {
Name string `json:"name,omitempty"`
IsSystem bool `json:"isSystem,omitempty"`
IfNotExists bool `json:"ifNotExists,omitempty"`
// 多数用于删除时候 串联删除相关内容
Cascade bool `json:"cascade,omitempty"`
// 扩展属性
Extend map[string]any `json:"param,omitempty"`
}
func DatabaseByMap ¶
type Dialect ¶
type Dialect interface {
Type() string
Match() []string
WrapNameChar() string
WrapStringChar() string
EscapeStringChar() string
ArgChar() string
FormatSqlArgChar(sqlInfo string) (res string)
FormatPageSql(sqlInfo string, pageSize int64, pageNo int64) (res string)
GetDriverName() string
GetDriverDSN(dbCfg *Config, params map[string]string) string
Open(dbCfg *Config, params map[string]string) (sqlDb *sql.DB, err error)
Info() (info *Info)
UserChange(sqlConn SqlConn, userName string, password string) (ok bool, err error)
UserSelectSql(userName string) (sqlInfo string, sqlArgs []any)
UserList(sqlConn SqlConn) (userList []*User, err error)
User(sqlConn SqlConn, userName string) (user *User, err error)
UserCreateFieldList() (sqlList []*Field)
UserCreateSql(handler DDLHandler, user *User) (sqlList []string, sqlArgsList [][]any)
UserCreate(sqlConn SqlConn, handler DDLHandler, user *User) (err error)
UserDeleteSql(handler DDLHandler, userName string) (sqlList []string, sqlArgsList [][]any)
UserDelete(sqlConn SqlConn, handler DDLHandler, userName string) (err error)
DatabaseChange(sqlConn SqlConn, databaseName string) (ok bool, err error)
DatabaseSelectSql(databaseName string) (sqlInfo string, sqlArgs []any)
DatabaseList(sqlConn SqlConn) (databaseList []*Database, err error)
Database(sqlConn SqlConn, databaseName string) (database *Database, err error)
DatabaseCreateFieldList() (sqlList []*Field)
DatabaseCreateSql(handler DDLHandler, database *Database) (sqlList []string, sqlArgsList [][]any)
DatabaseCreate(sqlConn SqlConn, handler DDLHandler, database *Database) (err error)
DatabaseDeleteSql(handler DDLHandler, databaseName string, cascade bool) (sqlList []string, sqlArgsList [][]any)
DatabaseDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, cascade bool) (err error)
SchemaChange(sqlConn SqlConn, schemaName string) (ok bool, err error)
SchemaSelectSql(databaseName string, schemaName string) (sqlInfo string, sqlArgs []any)
SchemaList(sqlConn SqlConn, databaseName string) (schemaList []*Schema, err error)
Schema(sqlConn SqlConn, databaseName string, schemaName string) (schema *Schema, err error)
SchemaCreateFieldList() (sqlList []*Field)
SchemaCreateSql(handler DDLHandler, databaseName string, schema *Schema) (sqlList []string, sqlArgsList [][]any)
SchemaCreate(sqlConn SqlConn, handler DDLHandler, databaseName string, schema *Schema) (err error)
SchemaDeleteSql(handler DDLHandler, databaseName string, schemaName string, cascade bool) (sqlList []string, sqlArgsList [][]any)
SchemaDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, cascade bool) (err error)
SequenceSelectSql(databaseName string, schemaName string, sequenceName string) (sqlInfo string, sqlArgs []any)
SequenceList(sqlConn SqlConn, databaseName string, schemaName string) (sequenceList []*Sequence, err error)
Sequence(sqlConn SqlConn, databaseName string, schemaName string, sequenceName string) (sequence *Sequence, err error)
SequenceCreateFieldList() (sqlList []*Field)
SequenceCreateSql(handler DDLHandler, databaseName string, schemaName string, sequence *Sequence) (sqlList []string, sqlArgsList [][]any)
SequenceCreate(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, sequence *Sequence) (err error)
SequenceDeleteSql(handler DDLHandler, databaseName string, schemaName string, sequenceName string) (sqlList []string, sqlArgsList [][]any)
SequenceDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, sequenceName string) (err error)
TableCheckExists(sqlConn SqlConn, databaseName string, schemaName string, tableName string) (exists bool)
TableSelectSql(databaseName string, schemaName string, tableName string) (sqlInfo string, sqlArgs []any)
TableList(sqlConn SqlConn, databaseName string, schemaName string) (tableList []*Table, err error)
Table(sqlConn SqlConn, databaseName string, schemaName string, tableName string) (table *Table, err error)
TableDetail(sqlConn SqlConn, databaseName string, schemaName string, tableName string) (table *Table, err error)
TableCreateFieldList() (sqlList []*Field)
TableCreateSql(handler DDLHandler, databaseName string, schemaName string, table *Table) (sqlList []string, sqlArgsList [][]any)
TableCreate(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, table *Table) (err error)
TableDeleteSql(handler DDLHandler, databaseName string, schemaName string, tableName string) (sqlList []string, sqlArgsList [][]any)
TableDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string) (err error)
ColumnCheckExists(sqlConn SqlConn, databaseName string, schemaName string, tableName string, columnName string) (exists bool)
ColumnSelectSql(databaseName string, schemaName string, tableName string, columnName string) (sqlInfo string, sqlArgs []any)
ColumnList(sqlConn SqlConn, databaseName string, schemaName string, tableName string) (columnList []*Column, err error)
Column(sqlConn SqlConn, databaseName string, schemaName string, tableName string, columnName string) (column *Column, err error)
ColumnAddSql(handler DDLHandler, databaseName string, schemaName string, tableName string, column *Column) (sqlList []string, sqlArgsList [][]any)
ColumnAdd(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string, column *Column) (err error)
ColumnUpdateSql(handler DDLHandler, databaseName string, schemaName string, tableName string, oldColumn *Column, column *Column) (sqlList []string, sqlArgsList [][]any)
ColumnUpdate(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string, oldColumn *Column, column *Column) (err error)
ColumnDeleteSql(handler DDLHandler, databaseName string, schemaName string, tableName string, columnName string) (sqlList []string, sqlArgsList [][]any)
ColumnDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string, columnName string) (err error)
ConstraintSelectSql(databaseName string, schemaName string, tableName string, constraintName string) (sqlInfo string, sqlArgs []any)
ConstraintList(sqlConn SqlConn, databaseName string, schemaName string, tableName string) (constraintList []*Constraint, err error)
Constraint(sqlConn SqlConn, databaseName string, schemaName string, tableName string, constraintName string) (constraint *Constraint, err error)
ConstraintAddSql(handler DDLHandler, databaseName string, schemaName string, tableName string, constraint *Constraint) (sqlList []string, sqlArgsList [][]any)
ConstraintAdd(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string, constraint *Constraint) (err error)
ConstraintDeleteSql(handler DDLHandler, databaseName string, schemaName string, tableName string, constraintName string) (sqlList []string, sqlArgsList [][]any)
ConstraintDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string, constraintName string) (err error)
IndexCheckExists(sqlConn SqlConn, databaseName string, schemaName string, tableName string, checkIndex *Index) (exists bool)
IndexSelectSql(databaseName string, schemaName string, tableName string, indexName string) (sqlInfo string, sqlArgs []any)
IndexList(sqlConn SqlConn, databaseName string, schemaName string, tableName string) (indexList []*Index, err error)
Index(sqlConn SqlConn, databaseName string, schemaName string, tableName string, indexName string) (index *Index, err error)
IndexAddSql(handler DDLHandler, databaseName string, schemaName string, tableName string, index *Index) (sqlList []string, sqlArgsList [][]any)
IndexAdd(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string, index *Index) (err error)
IndexDeleteSql(handler DDLHandler, databaseName string, schemaName string, tableName string, indexName string) (sqlList []string, sqlArgsList [][]any)
IndexDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string, indexName string) (err error)
SqlConcat(args ...string) (res string)
}
func AddDialect ¶
func GetDialect ¶
func NewDialect ¶
func NewDialect(cfg *DialectConfig) Dialect
type DialectColumnConfig ¶
type DialectColumnConfig struct {
// 查询 SQL 字段:databaseName、schemaName、tableName;参数:databaseName、schemaName、tableName
Select string `yaml:"select,omitempty"`
// 创建 SQL 参数:databaseName、schemaName、tableName、加上表单字段
Add string `yaml:"add,omitempty"`
Comment string `yaml:"comment,omitempty"`
Update string `yaml:"update,omitempty"`
UpdateRename string `yaml:"updateRename,omitempty"`
UpdateType string `yaml:"updateType,omitempty"`
UpdateNotNull string `yaml:"updateNotNull,omitempty"`
UpdateDefault string `yaml:"updateDefault,omitempty"`
// 删除 SQL 参数:databaseName、schemaName、tableName
Delete string `yaml:"delete,omitempty"`
}
type DialectConfig ¶
type DialectConfig struct {
// 方言类型
Type string `yaml:"type,omitempty"`
// 查找方言 传入的类型 匹配 type 或 以下配置的字符 则使用该方言
Match []string `yaml:"match,omitempty"`
// 使用 其它方言作为基础数据,可以配置覆盖
Extend string `yaml:"extend,omitempty"`
// 驱动
Driver *DialectDriverConfig `yaml:"driver,omitempty"`
// 名称包裹字符 如:`name_1`、"name_1"
NameWrapChar string `yaml:"nameWrapChar,omitempty"`
// 名称 没有包装 则自动转大写
NameNoWrapIsUpper bool `yaml:"nameNoWrapIsUpper,omitempty"`
// 字符串包裹字符 如:'string_1'
StringWrapChar string `yaml:"stringWrapChar,omitempty"`
/// 字符串转义字符 如:'xx\'x'
StringEscapeChar string `yaml:"stringEscapeChar,omitempty"`
// 变量占位符 如:?、$num、:name、?num
ArgChar string `yaml:"argChar,omitempty"`
// 结构关系 如:database = schema
Relation string `yaml:"relation,omitempty"`
// 表单
FormList []*Form `yaml:"formList,omitempty"`
// 树形配置
Tree []*DialectNodeConfig `yaml:"tree,omitempty"`
// 用户
User *DialectUserConfig `yaml:"user,omitempty"`
// 库
Database *DialectDatabaseConfig `yaml:"database,omitempty"`
// 模式
Schema *DialectSchemaConfig `yaml:"schema,omitempty"`
// 序列
Sequence *DialectSequenceConfig `yaml:"sequence,omitempty"`
// 表
Table *DialectTableConfig `yaml:"table,omitempty"`
// 字段
Column *DialectColumnConfig `yaml:"column,omitempty"`
// 约束
Constraint *DialectConstraintConfig `yaml:"constraint,omitempty"`
// 索引
Index *DialectIndexConfig `yaml:"index,omitempty"`
TypeExtend bool `yaml:"typeExtend,omitempty"`
TypeList []*DialectTypeConfig `yaml:"typeList,omitempty"`
FuncExtend bool `yaml:"funcExtend,omitempty"`
FuncList map[string]map[string]any `yaml:"funcList,omitempty"`
// contains filtered or unexported fields
}
func AddDialectConfig ¶
func AddDialectConfig(cfg *DialectConfig) *DialectConfig
func GetDialectConfig ¶
func GetDialectConfig(name string) *DialectConfig
func LoadDialectConfigByFile ¶
func LoadDialectConfigByFile(configFile string) (cfg *DialectConfig, err error)
func ToDialectConfigByBytes ¶
func ToDialectConfigByBytes(configFile string, bs []byte) (cfg *DialectConfig, err error)
func (*DialectConfig) CreateUserAutoCreateDatabase ¶
func (this_ *DialectConfig) CreateUserAutoCreateDatabase() bool
func (*DialectConfig) CreateUserAutoCreateSchema ¶
func (this_ *DialectConfig) CreateUserAutoCreateSchema() bool
func (*DialectConfig) FindFunc ¶
func (this_ *DialectConfig) FindFunc(name string) (r map[string]any)
func (*DialectConfig) FindType ¶
func (this_ *DialectConfig) FindType(name string) (r *DialectTypeConfig)
func (*DialectConfig) GetArgChar ¶
func (this_ *DialectConfig) GetArgChar() string
func (*DialectConfig) GetColumnAdd ¶
func (this_ *DialectConfig) GetColumnAdd() (t *SqlTemplate)
func (*DialectConfig) GetColumnComment ¶
func (this_ *DialectConfig) GetColumnComment() (t *SqlTemplate)
func (*DialectConfig) GetColumnDelete ¶
func (this_ *DialectConfig) GetColumnDelete() (t *SqlTemplate)
func (*DialectConfig) GetColumnSelect ¶
func (this_ *DialectConfig) GetColumnSelect() (t *SqlTemplate)
func (*DialectConfig) GetColumnUpdate ¶
func (this_ *DialectConfig) GetColumnUpdate() (t *SqlTemplate)
func (*DialectConfig) GetColumnUpdateDefault ¶
func (this_ *DialectConfig) GetColumnUpdateDefault() (t *SqlTemplate)
func (*DialectConfig) GetColumnUpdateNotNull ¶
func (this_ *DialectConfig) GetColumnUpdateNotNull() (t *SqlTemplate)
func (*DialectConfig) GetColumnUpdateRename ¶
func (this_ *DialectConfig) GetColumnUpdateRename() (t *SqlTemplate)
func (*DialectConfig) GetColumnUpdateType ¶
func (this_ *DialectConfig) GetColumnUpdateType() (t *SqlTemplate)
func (*DialectConfig) GetConstraintAdd ¶
func (this_ *DialectConfig) GetConstraintAdd() (t *SqlTemplate)
func (*DialectConfig) GetConstraintComment ¶
func (this_ *DialectConfig) GetConstraintComment() (t *SqlTemplate)
func (*DialectConfig) GetConstraintDelete ¶
func (this_ *DialectConfig) GetConstraintDelete() (t *SqlTemplate)
func (*DialectConfig) GetConstraintSelect ¶
func (this_ *DialectConfig) GetConstraintSelect() (t *SqlTemplate)
func (*DialectConfig) GetDatabaseChange ¶
func (this_ *DialectConfig) GetDatabaseChange() (t *SqlTemplate)
func (*DialectConfig) GetDatabaseCreate ¶
func (this_ *DialectConfig) GetDatabaseCreate() (t *SqlTemplate)
func (*DialectConfig) GetDatabaseCreateFieldList ¶
func (this_ *DialectConfig) GetDatabaseCreateFieldList() (res []*Field)
func (*DialectConfig) GetDatabaseDelete ¶
func (this_ *DialectConfig) GetDatabaseDelete() (t *SqlTemplate)
func (*DialectConfig) GetDatabaseSelect ¶
func (this_ *DialectConfig) GetDatabaseSelect() (t *SqlTemplate)
func (*DialectConfig) GetDriver ¶
func (this_ *DialectConfig) GetDriver() *DialectDriverConfig
func (*DialectConfig) GetIndexAdd ¶
func (this_ *DialectConfig) GetIndexAdd() (t *SqlTemplate)
func (*DialectConfig) GetIndexComment ¶
func (this_ *DialectConfig) GetIndexComment() (t *SqlTemplate)
func (*DialectConfig) GetIndexDelete ¶
func (this_ *DialectConfig) GetIndexDelete() (t *SqlTemplate)
func (*DialectConfig) GetIndexSelect ¶
func (this_ *DialectConfig) GetIndexSelect() (t *SqlTemplate)
func (*DialectConfig) GetNameNoWrapIsUpper ¶
func (this_ *DialectConfig) GetNameNoWrapIsUpper() bool
func (*DialectConfig) GetNameWrapChar ¶
func (this_ *DialectConfig) GetNameWrapChar() string
func (*DialectConfig) GetSchemaChange ¶
func (this_ *DialectConfig) GetSchemaChange() (t *SqlTemplate)
func (*DialectConfig) GetSchemaCreate ¶
func (this_ *DialectConfig) GetSchemaCreate() (t *SqlTemplate)
func (*DialectConfig) GetSchemaCreateFieldList ¶
func (this_ *DialectConfig) GetSchemaCreateFieldList() (res []*Field)
func (*DialectConfig) GetSchemaDelete ¶
func (this_ *DialectConfig) GetSchemaDelete() (t *SqlTemplate)
func (*DialectConfig) GetSchemaSelect ¶
func (this_ *DialectConfig) GetSchemaSelect() (t *SqlTemplate)
func (*DialectConfig) GetSequenceCreate ¶
func (this_ *DialectConfig) GetSequenceCreate() (t *SqlTemplate)
func (*DialectConfig) GetSequenceCreateFieldList ¶
func (this_ *DialectConfig) GetSequenceCreateFieldList() (res []*Field)
func (*DialectConfig) GetSequenceDelete ¶
func (this_ *DialectConfig) GetSequenceDelete() (t *SqlTemplate)
func (*DialectConfig) GetSequenceSelect ¶
func (this_ *DialectConfig) GetSequenceSelect() (t *SqlTemplate)
func (*DialectConfig) GetStringEscapeChar ¶
func (this_ *DialectConfig) GetStringEscapeChar() string
func (*DialectConfig) GetStringWrapChar ¶
func (this_ *DialectConfig) GetStringWrapChar() string
func (*DialectConfig) GetTableCreate ¶
func (this_ *DialectConfig) GetTableCreate() (t *SqlTemplate)
func (*DialectConfig) GetTableCreateColumn ¶
func (this_ *DialectConfig) GetTableCreateColumn() (t *SqlTemplate)
func (*DialectConfig) GetTableCreateColumnComment ¶
func (this_ *DialectConfig) GetTableCreateColumnComment() (t *SqlTemplate)
func (*DialectConfig) GetTableCreateComment ¶
func (this_ *DialectConfig) GetTableCreateComment() (t *SqlTemplate)
func (*DialectConfig) GetTableCreateConstraint ¶
func (this_ *DialectConfig) GetTableCreateConstraint() (t *SqlTemplate)
func (*DialectConfig) GetTableCreateConstraintComment ¶
func (this_ *DialectConfig) GetTableCreateConstraintComment() (t *SqlTemplate)
func (*DialectConfig) GetTableCreateFieldList ¶
func (this_ *DialectConfig) GetTableCreateFieldList() (res []*Field)
func (*DialectConfig) GetTableCreateIndex ¶
func (this_ *DialectConfig) GetTableCreateIndex() (t *SqlTemplate)
func (*DialectConfig) GetTableCreateIndexComment ¶
func (this_ *DialectConfig) GetTableCreateIndexComment() (t *SqlTemplate)
func (*DialectConfig) GetTableCreateSequenceTrigger ¶
func (this_ *DialectConfig) GetTableCreateSequenceTrigger() (t *SqlTemplate)
func (*DialectConfig) GetTableDelete ¶
func (this_ *DialectConfig) GetTableDelete() (t *SqlTemplate)
func (*DialectConfig) GetTableSelect ¶
func (this_ *DialectConfig) GetTableSelect() (t *SqlTemplate)
func (*DialectConfig) GetUserChange ¶
func (this_ *DialectConfig) GetUserChange() (t *SqlTemplate)
func (*DialectConfig) GetUserCreate ¶
func (this_ *DialectConfig) GetUserCreate() (t *SqlTemplate)
func (*DialectConfig) GetUserCreateFieldList ¶
func (this_ *DialectConfig) GetUserCreateFieldList() (res []*Field)
func (*DialectConfig) GetUserDelete ¶
func (this_ *DialectConfig) GetUserDelete() (t *SqlTemplate)
func (*DialectConfig) GetUserSelect ¶
func (this_ *DialectConfig) GetUserSelect() (t *SqlTemplate)
func (*DialectConfig) Init ¶
func (this_ *DialectConfig) Init() (err error)
func (*DialectConfig) IsSystemDatabase ¶
func (this_ *DialectConfig) IsSystemDatabase(name string) bool
func (*DialectConfig) IsSystemSchema ¶
func (this_ *DialectConfig) IsSystemSchema(name string) bool
func (*DialectConfig) IsSystemUser ¶
func (this_ *DialectConfig) IsSystemUser(name string) bool
func (*DialectConfig) MatchType ¶
func (this_ *DialectConfig) MatchType(dataType string, length, precision, scale int) (r *DialectTypeConfig)
func (*DialectConfig) NewPlaceSqlTemplate ¶
func (this_ *DialectConfig) NewPlaceSqlTemplate(place string, sqlInfo string) (res *SqlTemplate, err error)
type DialectConstraintConfig ¶
type DialectConstraintConfig struct {
// 查询 SQL 字段:databaseName、schemaName、tableName;参数:databaseName、schemaName、tableName
Select string `yaml:"select,omitempty"`
// 创建 SQL 参数:databaseName、schemaName、tableName、加上表单字段
Add string `yaml:"add,omitempty"`
Comment string `yaml:"comment,omitempty"`
// 删除 SQL 参数:databaseName、schemaName、tableName
Delete string `yaml:"delete,omitempty"`
}
type DialectDatabaseConfig ¶
type DialectDatabaseConfig struct {
Change string `yaml:"change,omitempty"`
// 查询 SQL 字段:databaseName;参数:databaseName
Select string `yaml:"select,omitempty"`
// 创建 SQL 参数:databaseName、加上表单字段
Create string `yaml:"create,omitempty"`
// 创建 SQL 附件 字段
CreateFieldList []*Field `yaml:"createFieldList,omitempty"`
// 删除 SQL 参数:databaseName
Delete string `yaml:"delete,omitempty"`
// 需要切换用户
ShouldChangeUser bool `yaml:"shouldChangeUser,omitempty"`
// 需要切换数据库
ShouldChangeDatabase bool `yaml:"shouldChangeDatabase,omitempty"`
// 需要切换模式
ShouldChangeSchema bool `yaml:"shouldChangeSchema,omitempty"`
Systems []string `yaml:"systems,omitempty"`
}
type DialectDriverConfig ¶
type DialectDriverConfig struct {
Name string `yaml:"name,omitempty"`
Dsn string `yaml:"dsn,omitempty"`
IsUrl bool `yaml:"isUrl,omitempty"`
// 驱动连接中 是否可以包含 数据库
HasDatabase bool `yaml:"hasDatabase,omitempty"`
// 驱动连接中 是否可以包含 模式
HasSchema bool `yaml:"hasSchema,omitempty"`
// 值是否可以 编码 用于特殊字符
CanPathEscape bool `yaml:"canPathEscape,omitempty"`
// 参数间隔 字符 非 url 使用,默认为 " "
ParamSpaceChar string `yaml:"paramSpaceChar,omitempty"`
Params map[string]string `yaml:"params,omitempty"`
}
type DialectIndexConfig ¶
type DialectIndexConfig struct {
// 查询 SQL 字段:databaseName、schemaName、tableName;参数:databaseName、schemaName、tableName
Select string `yaml:"select,omitempty"`
// 创建 SQL 参数:databaseName、schemaName、tableName、加上表单字段
Add string `yaml:"add,omitempty"`
Comment string `yaml:"comment,omitempty"`
// 删除 SQL 参数:databaseName、schemaName、tableName
Delete string `yaml:"delete,omitempty"`
}
type DialectNodeConfig ¶
type DialectNodeConfig struct {
Name string `yaml:"name,omitempty"`
Comment string `yaml:"comment,omitempty"`
Rule string `yaml:"rule,omitempty"`
// 需要切换用户
ShouldChangeUser bool `yaml:"shouldChangeUser,omitempty"`
// 需要切换数据库
ShouldChangeDatabase bool `yaml:"shouldChangeDatabase,omitempty"`
// 需要切换模式
ShouldChangeSchema bool `yaml:"shouldChangeSchema,omitempty"`
Children []*DialectNodeConfig `yaml:"children,omitempty"`
}
type DialectSchemaConfig ¶
type DialectSchemaConfig struct {
Change string `yaml:"change,omitempty"`
// 查询 SQL 字段:databaseName、schemaName;参数:databaseName、schemaName
Select string `yaml:"select,omitempty"`
// 创建 SQL 参数:databaseName、schemaName、加上表单字段
Create string `yaml:"create,omitempty"`
// 创建 SQL 附件 字段
CreateFieldList []*Field `yaml:"createFieldList,omitempty"`
// 删除 SQL 参数:databaseName、schemaName
Delete string `yaml:"delete,omitempty"`
// 需要切换用户
ShouldChangeUser bool `yaml:"shouldChangeUser,omitempty"`
// 需要切换数据库
ShouldChangeDatabase bool `yaml:"shouldChangeDatabase,omitempty"`
// 需要切换模式
ShouldChangeSchema bool `yaml:"shouldChangeSchema,omitempty"`
Systems []string `yaml:"systems,omitempty"`
}
type DialectSequenceConfig ¶
type DialectSequenceConfig struct {
// 查询 SQL 字段:databaseName、schemaName;参数:databaseName、schemaName
Select string `yaml:"select,omitempty"`
// 创建 SQL 参数:databaseName、schemaName、加上表单字段
Create string `yaml:"create,omitempty"`
// 创建 SQL 附件 字段
CreateFieldList []*Field `yaml:"createFieldList,omitempty"`
// 删除 SQL 参数:databaseName、schemaName
Delete string `yaml:"delete,omitempty"`
}
type DialectService ¶
type DialectService struct {
// contains filtered or unexported fields
}
func (*DialectService) AppendParam ¶
func (this_ *DialectService) AppendParam(handler DDLHandler, param map[string]any, obj any, ignoreNames ...string)
func (*DialectService) AppendParamExtend ¶
func (this_ *DialectService) AppendParamExtend(handler DDLHandler, param map[string]any, extend map[string]any)
func (*DialectService) AppendParamTableName ¶
func (this_ *DialectService) AppendParamTableName(handler DDLHandler, param map[string]any, databaseName string, schemaName string, tableName string)
func (*DialectService) ArgChar ¶
func (this_ *DialectService) ArgChar() string
func (*DialectService) ColumnAdd ¶
func (this_ *DialectService) ColumnAdd(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string, column *Column) (err error)
func (*DialectService) ColumnAddSql ¶
func (this_ *DialectService) ColumnAddSql(handler DDLHandler, databaseName string, schemaName string, tableName string, column *Column) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) ColumnCheckExists ¶
func (*DialectService) ColumnComment ¶
func (this_ *DialectService) ColumnComment(handler DDLHandler, databaseName string, schemaName string, tableName string, column *Column) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) ColumnCommentSql ¶
func (this_ *DialectService) ColumnCommentSql(handler DDLHandler, databaseName string, schemaName string, tableName string, column *Column) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) ColumnDelete ¶
func (this_ *DialectService) ColumnDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string, columnName string) (err error)
func (*DialectService) ColumnDeleteSql ¶
func (this_ *DialectService) ColumnDeleteSql(handler DDLHandler, databaseName string, schemaName string, tableName string, columnName string) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) ColumnFull ¶
func (*DialectService) ColumnList ¶
func (*DialectService) ColumnParam ¶
func (this_ *DialectService) ColumnParam(handler DDLHandler, databaseName string, schemaName string, tableName string, column *Column) (param map[string]any)
func (*DialectService) ColumnSelectSql ¶
func (*DialectService) ColumnUpdate ¶
func (this_ *DialectService) ColumnUpdate(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string, oldColumn *Column, column *Column) (err error)
func (*DialectService) ColumnUpdateSql ¶
func (this_ *DialectService) ColumnUpdateSql(handler DDLHandler, databaseName string, schemaName string, tableName string, oldColumn *Column, column *Column) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) Constraint ¶
func (this_ *DialectService) Constraint(sqlConn SqlConn, databaseName string, schemaName string, tableName string, constraintName string) (constraint *Constraint, err error)
func (*DialectService) ConstraintAdd ¶
func (this_ *DialectService) ConstraintAdd(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string, constraint *Constraint) (err error)
func (*DialectService) ConstraintAddSql ¶
func (this_ *DialectService) ConstraintAddSql(handler DDLHandler, databaseName string, schemaName string, tableName string, constraint *Constraint) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) ConstraintComment ¶
func (this_ *DialectService) ConstraintComment(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string, constraint *Constraint) (err error)
func (*DialectService) ConstraintCommentSql ¶
func (this_ *DialectService) ConstraintCommentSql(handler DDLHandler, databaseName string, schemaName string, tableName string, constraint *Constraint) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) ConstraintDelete ¶
func (this_ *DialectService) ConstraintDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string, constraintName string) (err error)
func (*DialectService) ConstraintDeleteSql ¶
func (this_ *DialectService) ConstraintDeleteSql(handler DDLHandler, databaseName string, schemaName string, tableName string, constraintName string) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) ConstraintList ¶
func (this_ *DialectService) ConstraintList(sqlConn SqlConn, databaseName string, schemaName string, tableName string) (constraintList []*Constraint, err error)
func (*DialectService) ConstraintParam ¶
func (this_ *DialectService) ConstraintParam(handler DDLHandler, databaseName string, schemaName string, tableName string, constraint *Constraint) (param map[string]any)
func (*DialectService) ConstraintSelectSql ¶
func (*DialectService) Database ¶
func (this_ *DialectService) Database(sqlConn SqlConn, databaseName string) (database *Database, err error)
func (*DialectService) DatabaseChange ¶
func (this_ *DialectService) DatabaseChange(sqlConn SqlConn, databaseName string) (ok bool, err error)
func (*DialectService) DatabaseCreate ¶
func (this_ *DialectService) DatabaseCreate(sqlConn SqlConn, handler DDLHandler, database *Database) (err error)
func (*DialectService) DatabaseCreateFieldList ¶
func (this_ *DialectService) DatabaseCreateFieldList() (sqlList []*Field)
func (*DialectService) DatabaseCreateSql ¶
func (this_ *DialectService) DatabaseCreateSql(handler DDLHandler, database *Database) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) DatabaseDelete ¶
func (this_ *DialectService) DatabaseDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, cascade bool) (err error)
func (*DialectService) DatabaseDeleteSql ¶
func (this_ *DialectService) DatabaseDeleteSql(handler DDLHandler, databaseName string, cascade bool) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) DatabaseList ¶
func (this_ *DialectService) DatabaseList(sqlConn SqlConn) (databaseList []*Database, err error)
func (*DialectService) DatabaseParam ¶
func (this_ *DialectService) DatabaseParam(handler DDLHandler, database *Database) (param map[string]any)
func (*DialectService) DatabaseSelectSql ¶
func (this_ *DialectService) DatabaseSelectSql(databaseName string) (sqlInfo string, sqlArgs []any)
func (*DialectService) EscapeStringChar ¶
func (this_ *DialectService) EscapeStringChar() string
func (*DialectService) Exec ¶
func (this_ *DialectService) Exec(sqlConn SqlConn, sqlInfo string, sqlArgs []any) (err error)
func (*DialectService) Execs ¶
func (this_ *DialectService) Execs(sqlConn SqlConn, sqlList []string, sqlArgsList [][]any) (err error)
func (*DialectService) FormatPageSql ¶
func (this_ *DialectService) FormatPageSql(sqlInfo string, pageSize int64, pageNo int64) (res string)
func (*DialectService) FormatSqlArgChar ¶
func (this_ *DialectService) FormatSqlArgChar(sqlInfo string) (res string)
func (*DialectService) GetColumnDefault ¶
func (this_ *DialectService) GetColumnDefault(handler DDLHandler, column *Column) (res string)
func (*DialectService) GetColumnType ¶
func (this_ *DialectService) GetColumnType(handler DDLHandler, column *Column) (columnType string)
func (*DialectService) GetDDLHandler ¶
func (this_ *DialectService) GetDDLHandler(handler DDLHandler) DDLHandler
func (*DialectService) GetDriverDSN ¶
func (this_ *DialectService) GetDriverDSN(dbCfg *Config, params map[string]string) string
func (*DialectService) GetDriverName ¶
func (this_ *DialectService) GetDriverName() string
func (*DialectService) GetParam ¶
func (this_ *DialectService) GetParam(handler DDLHandler, obj any) (param map[string]any)
func (*DialectService) IndexAdd ¶
func (this_ *DialectService) IndexAdd(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string, index *Index) (err error)
func (*DialectService) IndexAddSql ¶
func (this_ *DialectService) IndexAddSql(handler DDLHandler, databaseName string, schemaName string, tableName string, index *Index) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) IndexCheckExists ¶
func (*DialectService) IndexComment ¶
func (this_ *DialectService) IndexComment(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string, index *Index) (err error)
func (*DialectService) IndexCommentSql ¶
func (this_ *DialectService) IndexCommentSql(handler DDLHandler, databaseName string, schemaName string, tableName string, index *Index) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) IndexDelete ¶
func (this_ *DialectService) IndexDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string, indexName string) (err error)
func (*DialectService) IndexDeleteSql ¶
func (this_ *DialectService) IndexDeleteSql(handler DDLHandler, databaseName string, schemaName string, tableName string, indexName string) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) IndexParam ¶
func (this_ *DialectService) IndexParam(handler DDLHandler, databaseName string, schemaName string, tableName string, index *Index) (param map[string]any)
func (*DialectService) IndexSelectSql ¶
func (*DialectService) Info ¶
func (this_ *DialectService) Info() (info *Info)
func (*DialectService) IsAppendDatabaseName ¶
func (this_ *DialectService) IsAppendDatabaseName() bool
func (*DialectService) IsAppendSchemaName ¶
func (this_ *DialectService) IsAppendSchemaName() bool
func (*DialectService) Match ¶
func (this_ *DialectService) Match() []string
func (*DialectService) Names ¶
func (this_ *DialectService) Names(names ...string) (res string)
func (*DialectService) SchemaChange ¶
func (this_ *DialectService) SchemaChange(sqlConn SqlConn, schemaName string) (ok bool, err error)
func (*DialectService) SchemaCreate ¶
func (this_ *DialectService) SchemaCreate(sqlConn SqlConn, handler DDLHandler, databaseName string, schema *Schema) (err error)
func (*DialectService) SchemaCreateFieldList ¶
func (this_ *DialectService) SchemaCreateFieldList() (sqlList []*Field)
func (*DialectService) SchemaCreateSql ¶
func (this_ *DialectService) SchemaCreateSql(handler DDLHandler, databaseName string, schema *Schema) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) SchemaDelete ¶
func (this_ *DialectService) SchemaDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, cascade bool) (err error)
func (*DialectService) SchemaDeleteSql ¶
func (this_ *DialectService) SchemaDeleteSql(handler DDLHandler, databaseName string, schemaName string, cascade bool) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) SchemaList ¶
func (this_ *DialectService) SchemaList(sqlConn SqlConn, databaseName string) (schemaList []*Schema, err error)
func (*DialectService) SchemaParam ¶
func (this_ *DialectService) SchemaParam(handler DDLHandler, databaseName string, schema *Schema) (param map[string]any)
func (*DialectService) SchemaSelectSql ¶
func (this_ *DialectService) SchemaSelectSql(databaseName string, schemaName string) (sqlInfo string, sqlArgs []any)
func (*DialectService) SequenceCreate ¶
func (this_ *DialectService) SequenceCreate(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, sequence *Sequence) (err error)
func (*DialectService) SequenceCreateFieldList ¶
func (this_ *DialectService) SequenceCreateFieldList() (sqlList []*Field)
func (*DialectService) SequenceCreateSql ¶
func (this_ *DialectService) SequenceCreateSql(handler DDLHandler, databaseName string, schemaName string, sequence *Sequence) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) SequenceDelete ¶
func (this_ *DialectService) SequenceDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, sequenceName string) (err error)
func (*DialectService) SequenceDeleteSql ¶
func (this_ *DialectService) SequenceDeleteSql(handler DDLHandler, databaseName string, schemaName string, sequenceName string) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) SequenceList ¶
func (*DialectService) SequenceParam ¶
func (this_ *DialectService) SequenceParam(handler DDLHandler, databaseName string, schemaName string, sequence *Sequence) (param map[string]any)
func (*DialectService) SequenceSelectSql ¶
func (*DialectService) SqlConcat ¶
func (this_ *DialectService) SqlConcat(args ...string) (res string)
func (*DialectService) TableCheckExists ¶
func (*DialectService) TableCreate ¶
func (this_ *DialectService) TableCreate(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, table *Table) (err error)
func (*DialectService) TableCreateFieldList ¶
func (this_ *DialectService) TableCreateFieldList() (sqlList []*Field)
func (*DialectService) TableCreateSql ¶
func (this_ *DialectService) TableCreateSql(handler DDLHandler, databaseName string, schemaName string, table *Table) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) TableDelete ¶
func (this_ *DialectService) TableDelete(sqlConn SqlConn, handler DDLHandler, databaseName string, schemaName string, tableName string) (err error)
func (*DialectService) TableDeleteSql ¶
func (this_ *DialectService) TableDeleteSql(handler DDLHandler, databaseName string, schemaName string, tableName string) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) TableDetail ¶
func (*DialectService) TableDetailList ¶
func (*DialectService) TableParam ¶
func (this_ *DialectService) TableParam(handler DDLHandler, databaseName string, schemaName string, table *Table) (param map[string]any)
func (*DialectService) TableSelectSql ¶
func (*DialectService) TemplateSql ¶
func (this_ *DialectService) TemplateSql(t *SqlTemplate, param map[string]any) (sqlInfo string, sqlArgs []any)
func (*DialectService) TemplateSqlList ¶
func (this_ *DialectService) TemplateSqlList(t *SqlTemplate, param map[string]any) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) Type ¶
func (this_ *DialectService) Type() string
func (*DialectService) User ¶
func (this_ *DialectService) User(sqlConn SqlConn, userName string) (user *User, err error)
func (*DialectService) UserChange ¶
func (*DialectService) UserCreate ¶
func (this_ *DialectService) UserCreate(sqlConn SqlConn, handler DDLHandler, user *User) (err error)
func (*DialectService) UserCreateFieldList ¶
func (this_ *DialectService) UserCreateFieldList() (sqlList []*Field)
func (*DialectService) UserCreateSql ¶
func (this_ *DialectService) UserCreateSql(handler DDLHandler, user *User) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) UserDelete ¶
func (this_ *DialectService) UserDelete(sqlConn SqlConn, handler DDLHandler, userName string) (err error)
func (*DialectService) UserDeleteSql ¶
func (this_ *DialectService) UserDeleteSql(handler DDLHandler, userName string) (sqlList []string, sqlArgsList [][]any)
func (*DialectService) UserList ¶
func (this_ *DialectService) UserList(sqlConn SqlConn) (userList []*User, err error)
func (*DialectService) UserParam ¶
func (this_ *DialectService) UserParam(handler DDLHandler, user *User) (param map[string]any)
func (*DialectService) UserSelectSql ¶
func (this_ *DialectService) UserSelectSql(userName string) (sqlInfo string, sqlArgs []any)
func (*DialectService) WrapColumnName ¶
func (this_ *DialectService) WrapColumnName(name string) string
func (*DialectService) WrapConstraintName ¶
func (this_ *DialectService) WrapConstraintName(name string) string
func (*DialectService) WrapDatabaseName ¶
func (this_ *DialectService) WrapDatabaseName(name string) string
func (*DialectService) WrapIndexName ¶
func (this_ *DialectService) WrapIndexName(name string) string
func (*DialectService) WrapName ¶
func (this_ *DialectService) WrapName(name string) (res string)
func (*DialectService) WrapNameChar ¶
func (this_ *DialectService) WrapNameChar() string
func (*DialectService) WrapNames ¶
func (this_ *DialectService) WrapNames(wrapName func(name string) (res string), names ...string) (res string)
func (*DialectService) WrapSchemaName ¶
func (this_ *DialectService) WrapSchemaName(name string) string
func (*DialectService) WrapSequenceName ¶
func (this_ *DialectService) WrapSequenceName(name string) string
func (*DialectService) WrapString ¶
func (this_ *DialectService) WrapString(str string) (res string)
func (*DialectService) WrapStringChar ¶
func (this_ *DialectService) WrapStringChar() string
func (*DialectService) WrapTableName ¶
func (this_ *DialectService) WrapTableName(name string) string
func (*DialectService) WrapUserName ¶
func (this_ *DialectService) WrapUserName(name string) string
type DialectTableConfig ¶
type DialectTableConfig struct {
// 查询 SQL 字段:databaseName、schemaName、tableName;参数:databaseName、schemaName、tableName
Select string `yaml:"select,omitempty"`
// 创建 SQL 参数:databaseName、schemaName、tableName、加上表单字段
Create string `yaml:"create,omitempty"`
CreateComment string `yaml:"createComment,omitempty"`
// 创建 SQL 附件 字段
CreateFieldList []*Field `yaml:"createFieldList,omitempty"`
// 建表 字段 SQL 参数:columnName、columnType、notNull、
CreateColumn string `yaml:"createColumn,omitempty"`
CreateColumnComment string `yaml:"createColumnComment,omitempty"`
// 建表 约束 SQL 参数:columnName、columnType、notNull、
CreateConstraint string `yaml:"createConstraint,omitempty"`
CreateConstraintComment string `yaml:"createConstraintComment,omitempty"`
CreateSequenceTrigger string `yaml:"createSequenceTrigger,omitempty"`
// 建表 索引 SQL 参数:columnName、columnType、notNull、
CreateIndex string `yaml:"createIndex,omitempty"`
CreateIndexComment string `yaml:"createIndexComment,omitempty"`
Comment string `yaml:"comment,omitempty"`
// 删除 SQL 参数:databaseName、schemaName、tableName
Delete string `yaml:"delete,omitempty"`
// 需要切换用户
ShouldChangeUser bool `yaml:"shouldChangeUser,omitempty"`
// 需要切换数据库
ShouldChangeDatabase bool `yaml:"shouldChangeDatabase,omitempty"`
// 需要切换模式
ShouldChangeSchema bool `yaml:"shouldChangeSchema,omitempty"`
}
type DialectTypeConfig ¶
type DialectTypeConfig struct {
Name string `yaml:"name,omitempty"`
Format string `yaml:"format,omitempty"`
Args []string `yaml:"args,omitempty"`
Match []string `yaml:"match,omitempty"`
}
func (*DialectTypeConfig) FormatColumnType ¶
func (this_ *DialectTypeConfig) FormatColumnType(length, precision, scale int) (columnType string)
type DialectUserConfig ¶
type DialectUserConfig struct {
// 创建用户 会自动创建 数据库
AutoCreateDatabase bool `yaml:"autoCreateDatabase,omitempty"`
// 创建用户 会自动创建 模式
AutoCreateSchema bool `yaml:"autoCreateSchema,omitempty"`
Change string `yaml:"change,omitempty"`
// 查询 SQL 字段:userName;参数:userName
Select string `yaml:"select,omitempty"`
// 创建 SQL 参数:userName、password、加上表单指定
Create string `yaml:"create,omitempty"`
// 字段
CreateFieldList []*Field `yaml:"createFieldList,omitempty"`
// 删除 SQL 参数:userName
Delete string `yaml:"delete,omitempty"`
Systems []string `yaml:"systems,omitempty"`
}
type DmBlobType ¶
type DmClobType ¶
type Field ¶
type Field struct {
// 字段名称
Name string `yaml:"name,omitempty"`
// 标签
Label string `yaml:"label,omitempty"`
// 类型 text、password、select、redis、checkbox、json字符串,form
Type string `yaml:"type,omitempty"`
// 多个值
List bool `yaml:"list,omitempty"`
// 必填
Required bool `yaml:"required,omitempty"`
// 子表单
FormName string `yaml:"formName,omitempty"`
// 默认值
Default string `json:"default,omitempty"`
IsInteger bool `json:"isInteger,omitempty"`
}
type FieldSetterType ¶
type FiledGetColumn ¶
type FiledGetColumn func() string
type FiledGetValue ¶
type FiledGetValue func(columnName string, columnValue *util.FieldValue) any
type GetSqlValueType ¶
type GetSqlValueType func(columnType *sql.ColumnType, data any) (res any)
type HasStringFuncType ¶
type HasStringFuncType interface {
String() string
}
type IDynamicService ¶
type IGetObjectField ¶
type IGetObjectField interface {
GetObjectField(b *SqlBuilder, object any) (res any)
}
type IGetPrimaryKey ¶
type IGetPrimaryKey interface {
GetPrimaryKey() []string
}
type IGetTableName ¶
type IGetTableName interface {
GetTableName() string
}
type IModel ¶
type IModel interface {
IGetTableName
IGetPrimaryKey
}
type IService ¶
type IService interface {
Dialect
// Close 关闭 db 客户端
Close()
// GetConfig 获取 数据库 配置
GetConfig() Config
// GetDialect 获取 方言
GetDialect() Dialect
// GetSqlConn 获取 sql.DB
GetSqlConn() SqlConn
SetDynamicService(dynamicService IDynamicService)
GetDDLHandler() (handler DDLHandler)
GetModelOption() (modelOption *ModelOption)
ShowQuerySql() bool
ShowExecSql() bool
SqlHandler
// IDynamicService 动态数据源服务相关
IDynamicService
// Exec 执行 SQL
Exec(ctx context.Context, sql string, args []any) (result sql.Result, err error)
// Execs 批量执行 SQL
Execs(ctx context.Context, sqlList []string, argsList [][]any) (results []sql.Result, err error)
// QueryCount 统计查询 SQL
QueryCount(ctx context.Context, sql string, args []any) (count int64, err error)
// QueryMapOne 查询 单个 map SQL 返回 < map >
QueryMapOne(ctx context.Context, sql string, args []any) (one map[string]any, err error)
// QueryMapList 查询 列表 map SQL 返回 list < map >
QueryMapList(ctx context.Context, sql string, args []any) (list []map[string]any, err error)
// QueryMapPage 分页查询 列表 map 列表 SQL 返回 list < map >
QueryMapPage(ctx context.Context, sql string, args []any, pageSize int64, pageNo int64) (list []map[string]any, err error)
ModelSelect(model any, sets ...ModelSelectSet) (res *ModelSelect)
SqlSelect(table string, columns ...string) (res *SqlSelect)
Count(ctx context.Context, model IModel, sets ...ModelCountSet) (res int64, err error)
ModelCount(model any, sets ...ModelCountSet) (res *ModelCount)
SqlCount(table string, sets ...SqlCountSet) (res *SqlCount)
Insert(ctx context.Context, model IModel, sets ...ModelInsertSet) (res sql.Result, err error)
ModelInsert(model any, sets ...ModelInsertSet) (res *ModelInsert)
SqlInsert(table string, sets ...SqlInsertSet) (res *SqlInsert)
Update(ctx context.Context, model IModel, sets ...ModelUpdateSet) (res sql.Result, err error)
ModelUpdate(model any, sets ...ModelUpdateSet) (res *ModelUpdate)
SqlUpdate(table string, sets ...SqlUpdateSet) (res *SqlUpdate)
Delete(ctx context.Context, model IModel, sets ...ModelDeleteSet) (res sql.Result, err error)
ModelDelete(model any, sets ...ModelDeleteSet) (res *ModelDelete)
SqlDelete(table string, sets ...SqlDeleteSet) (res *SqlDelete)
}
type IncludedPlace ¶ added in v1.0.4
type IncludedPlace int
type Index ¶
type Index struct {
DatabaseName string `json:"databaseName,omitempty"`
SchemaName string `json:"schemaName,omitempty"`
TableName string `json:"tableName,omitempty"`
Name string `json:"name,omitempty"`
Comment string `json:"comment,omitempty"`
Type string `json:"type,omitempty"`
ColumnNames []string `json:"columnNames,omitempty"`
// 扩展属性
Extend map[string]any `json:"extend,omitempty"`
// contains filtered or unexported fields
}
func IndexListByColumns ¶
func IndexListByColumns(columns []*IndexColumn) (res []*Index)
type IndexColumn ¶
type IndexColumn struct {
DatabaseName string `json:"databaseName,omitempty"`
SchemaName string `json:"schemaName,omitempty"`
TableName string `json:"tableName,omitempty"`
Name string `json:"name,omitempty"`
Comment string `json:"comment,omitempty"`
Type string `json:"type,omitempty"`
ColumnName string `json:"columnName,omitempty"`
ColumnOrder int `json:"columnOrder,omitempty"`
// 扩展属性
Extend map[string]any `json:"extend,omitempty"`
}
func IndexColumnByMap ¶
func IndexColumnByMap(data map[string]any) (res *IndexColumn)
type Info ¶
type Info struct {
DriverName string
Dsn string
DsnHasDatabase bool
DsnHasSchema bool
// 名称 没有包装 则自动转大写
NameNoWrapIsUpper bool `json:"nameNoWrapIsUpper"`
// SQL 切换用户
SqlChangeUser bool `json:"canChangeUser"`
// SQL 切换数据库
SqlChangeDatabase bool `json:"canChangeDatabase"`
// SQL 切换模式
SqlChangeSchema bool `json:"canChangeSchema"`
// 是否有 用户
HasUser bool `json:"hasUser"`
// 是否有 库
HasDatabase bool `json:"hasDatabase"`
// 是否有 模式
HasSchema bool `json:"hasSchema"`
// 是否有 序列
HasSequence bool `json:"hasSequence"`
// 创建用户会自动创建 同名 数据库 则 用户登录 将自动登录到 同名 数据库 中
CreateUserAutoCreateDatabase bool `json:"createUserAutoCreateDatabase"`
// 创建用户会自动创建 同名 模式 则 用户登录 将自动登录到 同名 模式 中
CreateUserAutoCreateSchema bool `json:"createUserAutoCreateSchema"`
}
type InsertOrUpdateValue ¶
type ModelCount ¶
type ModelCount struct {
// 模型 设置 如:表名、主键、包含字段、忽略字段、空值设置 等
*ModelSetting
// contains filtered or unexported fields
}
func NewModelCount ¶ added in v1.0.3
func NewModelCount(model any) (res *ModelCount)
func (*ModelCount) Count ¶
func (this_ *ModelCount) Count(ctx context.Context) (res int64, err error)
func (*ModelCount) GetSql ¶
func (this_ *ModelCount) GetSql() (sqlInfo string, args []any, err error)
func (*ModelCount) SetWhere ¶
func (this_ *ModelCount) SetWhere(where *Conditions) *ModelCount
func (*ModelCount) Where ¶
func (this_ *ModelCount) Where() *Conditions
type ModelCountSet ¶ added in v1.0.4
type ModelCountSet = func(in *ModelCount)
type ModelDelete ¶
type ModelDelete struct {
// 模型 设置 如:表名、主键、包含字段、忽略字段、空值设置 等
*ModelSetting
// contains filtered or unexported fields
}
func NewModelDelete ¶ added in v1.0.3
func NewModelDelete(model any) (res *ModelDelete)
func (*ModelDelete) CanDeleteAll ¶ added in v1.0.4
func (this_ *ModelDelete) CanDeleteAll() *ModelDelete
CanDeleteAll 删除时候 必须 设置条件 除非 设置 CanDeleteAll
func (*ModelDelete) GetSql ¶
func (this_ *ModelDelete) GetSql() (sqlInfo string, args []any, err error)
func (*ModelDelete) SetWhere ¶
func (this_ *ModelDelete) SetWhere(where *Conditions) *ModelDelete
func (*ModelDelete) Where ¶
func (this_ *ModelDelete) Where() *Conditions
type ModelDeleteSet ¶ added in v1.0.4
type ModelDeleteSet = func(in *ModelDelete)
type ModelField ¶
type ModelField struct {
*util.StructField
// 是否 实现了 sql.Scanner 接口
ImplementsSqlScanner bool
ColumnName string
// contains filtered or unexported fields
}
type ModelInfo ¶
type ModelInfo struct {
*util.StructInfo
// contains filtered or unexported fields
}
type ModelInsert ¶
type ModelInsert struct {
// 模型 设置 如:表名、主键、包含字段、忽略字段、空值设置 等
*ModelSetting
// contains filtered or unexported fields
}
func NewModelInsert ¶ added in v1.0.3
func NewModelInsert(model any) (res *ModelInsert)
type ModelInsertSet ¶ added in v1.0.4
type ModelInsertSet = func(in *ModelInsert)
type ModelOption ¶
type ModelOption struct {
// 字段 tag 注解,默认 column 如:`column:"xx"`
ColumnTag string `json:"columnTag,omitempty"`
// 是否 使用json主键,如果 字段 tag 注解 未找到 使用 json 注解
ColumnUseJsonTag bool `json:"columnUseJsonTag,omitempty"`
// 如果 以上都未配置 使用 字段名称
ColumnUseFieldName bool `json:"columnUseFieldName,omitempty"`
// 字段名称 严格判断 默认 false `userId 将 匹配 Userid UserId USERID`,
ColumnStrictCase bool `json:"columnStrictCase,omitempty"`
// contains filtered or unexported fields
}
func NewModelOption ¶
func NewModelOption() (res *ModelOption)
func (*ModelOption) GetColumnValue ¶
func (this_ *ModelOption) GetColumnValue(modelV reflect.Value, columnName string) (fieldValue *util.FieldValue)
func (*ModelOption) GetColumnValues ¶
func (this_ *ModelOption) GetColumnValues(modelV reflect.Value) (columns []string, values []*util.FieldValue)
func (*ModelOption) GetColumns ¶
func (this_ *ModelOption) GetColumns(modelV reflect.Value) (columns []string)
func (*ModelOption) GetModelInfo ¶
func (this_ *ModelOption) GetModelInfo(inType reflect.Type) (info *ModelInfo)
func (*ModelOption) SetGetColumn ¶
func (this_ *ModelOption) SetGetColumn(getColumn FiledGetColumn) *ModelOption
func (*ModelOption) SetGetValue ¶
func (this_ *ModelOption) SetGetValue(getValue FiledGetValue) *ModelOption
type ModelSelect ¶
type ModelSelect struct {
// 模型 设置 如:表名、主键、包含字段、忽略字段、空值设置 等
*ModelSetting
// contains filtered or unexported fields
}
func NewModelSelect ¶ added in v1.0.3
func NewModelSelect(model any) (res *ModelSelect)
func (*ModelSelect) CanSelectAll ¶ added in v1.0.4
func (this_ *ModelSelect) CanSelectAll() *ModelSelect
CanSelectAll 查询时候 必须 设置条件 除非 设置 CanSelectAll
func (*ModelSelect) GetSql ¶
func (this_ *ModelSelect) GetSql() (sqlInfo string, args []any, err error)
func (*ModelSelect) SetWhere ¶
func (this_ *ModelSelect) SetWhere(where *Conditions) *ModelSelect
func (*ModelSelect) Where ¶
func (this_ *ModelSelect) Where() *Conditions
type ModelSelectSet ¶ added in v1.0.4
type ModelSelectSet = func(in *ModelSelect)
type ModelSetting ¶
type ModelSetting struct {
// contains filtered or unexported fields
}
func (*ModelSetting) AppendSql ¶ added in v1.0.4
func (this_ *ModelSetting) AppendSql(appendSql string, appendArgs ...any) *ModelSetting
func (*ModelSetting) EmptySelectExclude ¶ added in v1.0.4
func (this_ *ModelSetting) EmptySelectExclude() *ModelSetting
func (*ModelSetting) EmptySelectInclude ¶ added in v1.0.4
func (this_ *ModelSetting) EmptySelectInclude() *ModelSetting
func (*ModelSetting) EmptyUseNull ¶
func (this_ *ModelSetting) EmptyUseNull() *ModelSetting
EmptyUseNull 将 空字符串 值 设置为 null,需要 先设置 IncludeEmpty
func (*ModelSetting) EmptyValueExclude ¶ added in v1.0.4
func (this_ *ModelSetting) EmptyValueExclude() *ModelSetting
func (*ModelSetting) EmptyValueInclude ¶ added in v1.0.4
func (this_ *ModelSetting) EmptyValueInclude() *ModelSetting
func (*ModelSetting) EmptyWhereExclude ¶ added in v1.0.4
func (this_ *ModelSetting) EmptyWhereExclude() *ModelSetting
func (*ModelSetting) EmptyWhereInclude ¶ added in v1.0.4
func (this_ *ModelSetting) EmptyWhereInclude() *ModelSetting
func (*ModelSetting) GetAppendSql ¶ added in v1.0.4
func (this_ *ModelSetting) GetAppendSql() (appendSql string, appendArgs []any)
func (*ModelSetting) GetModelAndWhereSql ¶
func (this_ *ModelSetting) GetModelAndWhereSql(b *OrmSqlBuilder, model any, where *Conditions) (whereSql string, whereArgs []any)
func (*ModelSetting) GetPrimaryKey ¶
func (this_ *ModelSetting) GetPrimaryKey(model any) []string
func (*ModelSetting) GetService ¶
func (this_ *ModelSetting) GetService() IService
func (*ModelSetting) GetTableName ¶
func (this_ *ModelSetting) GetTableName(model any) string
func (*ModelSetting) GetValue ¶
func (this_ *ModelSetting) GetValue(columnValue *util.FieldValue) (isNull bool, res any)
func (*ModelSetting) IncludeEmpty ¶
func (this_ *ModelSetting) IncludeEmpty() *ModelSetting
IncludeEmpty 设置 包含 空字符串,默认 忽略 空字符串 值
func (*ModelSetting) IncludeNull ¶
func (this_ *ModelSetting) IncludeNull() *ModelSetting
IncludeNull 设置 包含 null,默认 忽略 null 值
func (*ModelSetting) IncludeZero ¶
func (this_ *ModelSetting) IncludeZero() *ModelSetting
IncludeZero 设置 包含 0,默认 忽略 0 值
func (*ModelSetting) Included ¶
func (this_ *ModelSetting) Included(place IncludedPlace, columnName string, columnValue *util.FieldValue) bool
func (*ModelSetting) IsSelectExclude ¶ added in v1.0.4
func (this_ *ModelSetting) IsSelectExclude(column string) bool
func (*ModelSetting) IsSelectInclude ¶ added in v1.0.4
func (this_ *ModelSetting) IsSelectInclude(column string) bool
func (*ModelSetting) IsValueExclude ¶ added in v1.0.4
func (this_ *ModelSetting) IsValueExclude(column string) bool
func (*ModelSetting) IsValueInclude ¶ added in v1.0.4
func (this_ *ModelSetting) IsValueInclude(column string) bool
func (*ModelSetting) IsWhereExclude ¶ added in v1.0.4
func (this_ *ModelSetting) IsWhereExclude(column string) bool
func (*ModelSetting) IsWhereInclude ¶ added in v1.0.4
func (this_ *ModelSetting) IsWhereInclude(column string) bool
func (*ModelSetting) NewBuilder ¶
func (this_ *ModelSetting) NewBuilder(model any) (res *OrmSqlBuilder)
func (*ModelSetting) SelectExclude ¶ added in v1.0.4
func (this_ *ModelSetting) SelectExclude(columns ...string) *ModelSetting
func (*ModelSetting) SelectInclude ¶ added in v1.0.4
func (this_ *ModelSetting) SelectInclude(columns ...string) *ModelSetting
func (*ModelSetting) SetModelOption ¶
func (this_ *ModelSetting) SetModelOption(modelOption *ModelOption) *ModelSetting
func (*ModelSetting) SetPrimaryKey ¶
func (this_ *ModelSetting) SetPrimaryKey(columns ...string) *ModelSetting
func (*ModelSetting) SetService ¶
func (this_ *ModelSetting) SetService(service *Service) *ModelSetting
func (*ModelSetting) SetSqlHandler ¶
func (this_ *ModelSetting) SetSqlHandler(sqlHandler SqlHandler) *ModelSetting
func (*ModelSetting) SetTableName ¶
func (this_ *ModelSetting) SetTableName(tableName string) *ModelSetting
func (*ModelSetting) ValueExclude ¶ added in v1.0.4
func (this_ *ModelSetting) ValueExclude(columns ...string) *ModelSetting
func (*ModelSetting) ValueInclude ¶ added in v1.0.4
func (this_ *ModelSetting) ValueInclude(columns ...string) *ModelSetting
func (*ModelSetting) WhereExclude ¶ added in v1.0.4
func (this_ *ModelSetting) WhereExclude(columns ...string) *ModelSetting
func (*ModelSetting) WhereInclude ¶ added in v1.0.4
func (this_ *ModelSetting) WhereInclude(columns ...string) *ModelSetting
func (*ModelSetting) WhereOperator ¶
func (this_ *ModelSetting) WhereOperator(column string, op string) *ModelSetting
func (*ModelSetting) ZeroUseNull ¶
func (this_ *ModelSetting) ZeroUseNull() *ModelSetting
ZeroUseNull 将 0 值 设置为 null,需要 先设置 IncludeZero
type ModelUpdate ¶
type ModelUpdate struct {
// 模型 设置 如:表名、主键、包含字段、忽略字段、空值设置 等
*ModelSetting
// contains filtered or unexported fields
}
func NewModelUpdate ¶ added in v1.0.3
func NewModelUpdate(model any) (res *ModelUpdate)
func (*ModelUpdate) CanUpdateAll ¶ added in v1.0.4
func (this_ *ModelUpdate) CanUpdateAll() *ModelUpdate
CanUpdateAll 更新时候 必须 设置条件 除非 设置 CanUpdateAll
func (*ModelUpdate) GetSql ¶
func (this_ *ModelUpdate) GetSql() (sqlInfo string, args []any, err error)
func (*ModelUpdate) SetWhere ¶
func (this_ *ModelUpdate) SetWhere(where *Conditions) *ModelUpdate
func (*ModelUpdate) Where ¶
func (this_ *ModelUpdate) Where() *Conditions
type ModelUpdateSet ¶ added in v1.0.4
type ModelUpdateSet = func(in *ModelUpdate)
type OrmSqlBuilder ¶
type OrmSqlBuilder struct {
*ModelOption
SqlHandler
// contains filtered or unexported fields
}
func (*OrmSqlBuilder) IsPrimaryKey ¶
func (this_ *OrmSqlBuilder) IsPrimaryKey(column string) bool
type ReadExpression ¶
type ReadExpression struct {
StartExpression SqlExpression `json:"startExpression,omitempty"`
LastExpression SqlExpression `json:"lastExpression,omitempty"`
Expressions []SqlExpression `json:"expressions,omitempty"`
}
func (*ReadExpression) Add ¶
func (this_ *ReadExpression) Add(e SqlExpression)
func (*ReadExpression) ReplaceLast ¶
func (this_ *ReadExpression) ReplaceLast(replaceIndex int, e SqlExpression)
type ReadScope ¶
type ReadScope struct {
InSelect bool `json:"inSelect,omitempty"`
InSelectColumn bool `json:"inSelectColumn,omitempty"`
InSelectFrom bool `json:"inSelectFrom,omitempty"`
InInsert bool `json:"inInsert,omitempty"`
InInsertColumn bool `json:"inInsertColumn,omitempty"`
InInsertValue bool `json:"inInsertValue,omitempty"`
InUpdate bool `json:"inUpdate,omitempty"`
InUpdateColumn bool `json:"inUpdateColumn,omitempty"`
InDelete bool `json:"inDelete,omitempty"`
InFrom bool `json:"inFrom,omitempty"`
InJoin bool `json:"inJoin,omitempty"`
InJoinOn bool `json:"inJoinOn,omitempty"`
InWhere bool `json:"inWhere,omitempty"`
InGroupBy bool `json:"inGroupBy,omitempty"`
InOrderBy bool `json:"inOrderBy,omitempty"`
InValue bool `json:"inValue,omitempty"`
InDDL bool `json:"inDDL,omitempty"`
InExpression bool `json:"inExpression,omitempty"`
// 解析 算术运算符: + - * / %
ArithmeticOperator bool `json:"arithmeticOperator,omitempty"`
// 解析 比较(关系)运算符: == != > < >= <=
RelationalOperator bool `json:"relationalOperator,omitempty"`
// 解析 逻辑运算符: && ||
LogicalOperator bool `json:"logicalOperator,omitempty"`
// contains filtered or unexported fields
}
type Schema ¶
type Schema struct {
DatabaseName string `json:"databaseName,omitempty"`
Name string `json:"name,omitempty"`
IsSystem bool `json:"isSystem,omitempty"`
IfNotExists bool `json:"ifNotExists,omitempty"`
// 多数用于删除时候 串联删除相关内容
Cascade bool `json:"cascade,omitempty"`
// 扩展属性
Extend map[string]any `json:"extend,omitempty"`
}
func SchemaByMap ¶
type Sequence ¶
type Sequence struct {
DatabaseName string `json:"databaseName,omitempty"`
SchemaName string `json:"schemaName,omitempty"`
Name string `json:"name,omitempty"`
// 序列 开始值
Start int64 `json:"start,omitempty"`
// 序列 每次增长
Increment int64 `json:"increment,omitempty"`
Min int64 `json:"min,omitempty"`
Max int64 `json:"max,omitempty"`
IfNotExists bool `json:"ifNotExists,omitempty"`
// 扩展属性
Extend map[string]any `json:"extend,omitempty"`
}
func SequenceByMap ¶
type Service ¶
type Service struct {
Dialect
// contains filtered or unexported fields
}
func (*Service) CheckColumnExist ¶
func (*Service) CheckIndexExist ¶
func (*Service) CheckTableExist ¶
func (*Service) CloseShowExecSql ¶
func (*Service) CloseShowQuerySql ¶
func (*Service) CreateIndex ¶
func (*Service) CreateTable ¶
func (*Service) GetDDLHandler ¶
func (this_ *Service) GetDDLHandler() (handler DDLHandler)
func (*Service) GetDatabaseName ¶
func (*Service) GetDialect ¶
func (*Service) GetModelOption ¶
func (this_ *Service) GetModelOption() (modelOption *ModelOption)
func (*Service) GetSchemaName ¶
func (*Service) GetSqlConn ¶
func (*Service) GetSqlHandler ¶
func (this_ *Service) GetSqlHandler() (handler SqlHandler)
func (*Service) GetSqlValue ¶
func (this_ *Service) GetSqlValue() GetSqlValueType
func (*Service) ModelCount ¶
func (this_ *Service) ModelCount(model any, sets ...ModelCountSet) (res *ModelCount)
func (*Service) ModelDelete ¶
func (this_ *Service) ModelDelete(model any, sets ...ModelDeleteSet) (res *ModelDelete)
func (*Service) ModelInsert ¶
func (this_ *Service) ModelInsert(model any, sets ...ModelInsertSet) (res *ModelInsert)
func (*Service) ModelSelect ¶
func (this_ *Service) ModelSelect(model any, sets ...ModelSelectSet) (res *ModelSelect)
func (*Service) ModelUpdate ¶
func (this_ *Service) ModelUpdate(model any, sets ...ModelUpdateSet) (res *ModelUpdate)
func (*Service) OpenShowExecSql ¶
func (*Service) OpenShowQuerySql ¶
func (*Service) QueryCount ¶
func (*Service) QueryMapList ¶
func (*Service) QueryMapOne ¶
func (*Service) QueryMapPage ¶
func (*Service) RealService ¶
func (*Service) RealTableName ¶
func (*Service) SetDDLHandler ¶
func (this_ *Service) SetDDLHandler(handler DDLHandler)
func (*Service) SetDynamicService ¶
func (this_ *Service) SetDynamicService(dynamicService IDynamicService)
func (*Service) SetFieldValue ¶
func (this_ *Service) SetFieldValue() SetFieldValueType
func (*Service) SetGetSqlValue ¶
func (this_ *Service) SetGetSqlValue(getSqlValue GetSqlValueType)
func (*Service) SetModelOption ¶
func (this_ *Service) SetModelOption(modelOption *ModelOption)
func (*Service) SetSetFieldValue ¶
func (this_ *Service) SetSetFieldValue(setFieldValue SetFieldValueType)
func (*Service) SetSqlHandler ¶
func (this_ *Service) SetSqlHandler(handler SqlHandler)
func (*Service) ShowExecSql ¶
func (*Service) ShowQuerySql ¶
func (*Service) SqlCount ¶
func (this_ *Service) SqlCount(table string, sets ...SqlCountSet) (res *SqlCount)
func (*Service) SqlDelete ¶
func (this_ *Service) SqlDelete(table string, sets ...SqlDeleteSet) (res *SqlDelete)
func (*Service) SqlInsert ¶
func (this_ *Service) SqlInsert(table string, sets ...SqlInsertSet) (res *SqlInsert)
func (*Service) SqlUpdate ¶
func (this_ *Service) SqlUpdate(table string, sets ...SqlUpdateSet) (res *SqlUpdate)
func (*Service) WrapColumnName ¶
type SetFieldValueType ¶
type SetFieldValueType func(columnType *sql.ColumnType, field reflect.StructField, fieldValue reflect.Value, value any) (err error)
type SqlBuilder ¶
type SqlBuilder struct {
*SqlParam
// contains filtered or unexported fields
}
func (*SqlBuilder) Append ¶
func (this_ *SqlBuilder) Append(s string, args ...any)
func (*SqlBuilder) GetValue ¶
func (this_ *SqlBuilder) GetValue(e SqlExpression) (res any)
func (*SqlBuilder) Test ¶
func (this_ *SqlBuilder) Test(test SqlExpression) (res bool)
type SqlConcatValue ¶
type SqlConfiguration ¶
type SqlConfiguration struct {
// contains filtered or unexported fields
}
func NewSqlConfiguration ¶
func NewSqlConfiguration(sets ...SqlConfigurationSet) (c *SqlConfiguration)
func (*SqlConfiguration) GetSqlHandler ¶
func (this_ *SqlConfiguration) GetSqlHandler() SqlHandler
func (*SqlConfiguration) SetSqlHandler ¶
func (this_ *SqlConfiguration) SetSqlHandler(sqlHandler SqlHandler) *SqlConfiguration
type SqlConfigurationSet ¶
type SqlConfigurationSet func(c *SqlConfiguration)
type SqlConn ¶
type SqlConn interface {
PingContext(ctx context.Context) error
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
}
type SqlCount ¶
type SqlCount struct {
// 模型 设置 如:表名、主键、包含字段、忽略字段、空值设置 等
*ModelSetting
// contains filtered or unexported fields
}
func (*SqlCount) SetWhere ¶
func (this_ *SqlCount) SetWhere(where *Conditions) *SqlCount
func (*SqlCount) Where ¶
func (this_ *SqlCount) Where() *Conditions
type SqlCountSet ¶ added in v1.0.4
type SqlCountSet = func(in *SqlCount)
type SqlDelete ¶
type SqlDelete struct {
// 模型 设置 如:表名、主键、包含字段、忽略字段、空值设置 等
*ModelSetting
// contains filtered or unexported fields
}
func (*SqlDelete) CanDeleteAll ¶ added in v1.0.4
CanDeleteAll 删除时候 必须 设置条件 除非 设置 CanDeleteAll
func (*SqlDelete) SetWhere ¶
func (this_ *SqlDelete) SetWhere(where *Conditions) *SqlDelete
func (*SqlDelete) Where ¶
func (this_ *SqlDelete) Where() *Conditions
type SqlDeleteSet ¶ added in v1.0.4
type SqlDeleteSet = func(in *SqlDelete)
type SqlExpression ¶
type SqlExpression interface {
GetValue(b *SqlBuilder) (res any)
// contains filtered or unexported methods
}
type SqlHandler ¶
type SqlHandler interface {
// RealTableName 获取真实 表名 ,SQL 中将使用返回的 表名 拼接 返回空 则不替换
RealTableName(param *SqlParam, tableName string) (realTableName string)
// WrapTableName 包装 表名 ,SQL 中将使用返回的 表名 拼接 返回空 则不替换
WrapTableName(param *SqlParam, tableName string) (wrapTableName string)
WrapColumnName(param *SqlParam, columnName string) (wrapColumnName string)
}
type SqlInsert ¶
type SqlInsert struct {
// 模型 设置 如:表名、主键、包含字段、忽略字段、空值设置 等
*ModelSetting
// contains filtered or unexported fields
}
type SqlInsertSet ¶ added in v1.0.4
type SqlInsertSet = func(in *SqlInsert)
type SqlNode ¶
type SqlNode interface {
Append(b *SqlBuilder)
// contains filtered or unexported methods
}
type SqlNodeArgParam ¶
type SqlNodeArgParam struct {
Param SqlExpression `json:"param,omitempty"`
}
func (*SqlNodeArgParam) Append ¶
func (this_ *SqlNodeArgParam) Append(b *SqlBuilder)
type SqlNodeArithmeticOperate ¶
type SqlNodeArithmeticOperate struct {
Left SqlExpression `json:"left"`
// 算术运算符: + - * / %
Operator string `json:"operator"`
Right SqlExpression `json:"right"`
}
SqlNodeArithmeticOperate 算术运算: + - * / %
func (*SqlNodeArithmeticOperate) GetValue ¶
func (this_ *SqlNodeArithmeticOperate) GetValue(b *SqlBuilder) (res any)
type SqlNodeBlock ¶
type SqlNodeBlock struct {
Children []SqlNode `json:"children"`
}
func (*SqlNodeBlock) Append ¶
func (this_ *SqlNodeBlock) Append(b *SqlBuilder)
type SqlNodeComment ¶
type SqlNodeComment struct {
Comment string `json:"comment"`
}
func (*SqlNodeComment) Append ¶
func (this_ *SqlNodeComment) Append(b *SqlBuilder)
type SqlNodeDDL ¶
type SqlNodeDDL struct {
*SqlNodeBlock
}
type SqlNodeDelete ¶
type SqlNodeDelete struct {
*SqlNodeBlock
}
type SqlNodeDotExpression ¶
type SqlNodeDotExpression struct {
Left SqlExpression `json:"left"`
Right SqlExpression `json:"right"`
}
func (*SqlNodeDotExpression) GetObjectField ¶
func (this_ *SqlNodeDotExpression) GetObjectField(b *SqlBuilder, object any) (res any)
func (*SqlNodeDotExpression) GetValue ¶
func (this_ *SqlNodeDotExpression) GetValue(b *SqlBuilder) (res any)
type SqlNodeElse ¶
type SqlNodeElse struct {
Children []SqlNode `json:"children"`
}
type SqlNodeElseIf ¶
type SqlNodeElseIf struct {
Test SqlExpression `json:"test"`
Children []SqlNode `json:"children"`
}
type SqlNodeFloat ¶
func ToSqlNodeFloat ¶
func ToSqlNodeFloat(str string) (res *SqlNodeFloat, err error)
func (*SqlNodeFloat) Append ¶
func (this_ *SqlNodeFloat) Append(b *SqlBuilder)
func (*SqlNodeFloat) GetValue ¶
func (this_ *SqlNodeFloat) GetValue(b *SqlBuilder) (res any)
type SqlNodeIdentifier ¶
type SqlNodeIdentifier struct {
Name string `json:"name"`
}
func (*SqlNodeIdentifier) GetObjectField ¶
func (this_ *SqlNodeIdentifier) GetObjectField(b *SqlBuilder, object any) (res any)
func (*SqlNodeIdentifier) GetValue ¶
func (this_ *SqlNodeIdentifier) GetValue(b *SqlBuilder) (res any)
type SqlNodeIf ¶
type SqlNodeIf struct {
Test SqlExpression `json:"test"`
Children []SqlNode `json:"children"`
ElseIfs []*SqlNodeElseIf `json:"elseIfs"`
Else *SqlNodeElse `json:"else"`
}
func (*SqlNodeIf) Append ¶
func (this_ *SqlNodeIf) Append(b *SqlBuilder)
type SqlNodeInsert ¶
type SqlNodeInsert struct {
*SqlNodeBlock
}
type SqlNodeInt ¶
func ToSqlNodeInt ¶
func ToSqlNodeInt(str string) (res *SqlNodeInt, err error)
func (*SqlNodeInt) Append ¶
func (this_ *SqlNodeInt) Append(b *SqlBuilder)
func (*SqlNodeInt) GetValue ¶
func (this_ *SqlNodeInt) GetValue(b *SqlBuilder) (res any)
type SqlNodeLogicalOperate ¶
type SqlNodeLogicalOperate struct {
Left SqlExpression `json:"left"`
// 逻辑运算符: && ||
Operator string `json:"operator"`
Right SqlExpression `json:"right"`
}
SqlNodeLogicalOperate 逻辑运算: && ||
func (*SqlNodeLogicalOperate) GetValue ¶
func (this_ *SqlNodeLogicalOperate) GetValue(b *SqlBuilder) (res any)
type SqlNodeOptional ¶
type SqlNodeOptional struct {
Children []SqlNode `json:"children"`
// contains filtered or unexported fields
}
func (*SqlNodeOptional) Append ¶
func (this_ *SqlNodeOptional) Append(b *SqlBuilder)
type SqlNodeParam ¶
type SqlNodeParam struct {
Param SqlExpression `json:"param,omitempty"`
}
func (*SqlNodeParam) Append ¶
func (this_ *SqlNodeParam) Append(b *SqlBuilder)
type SqlNodeParenthesis ¶
type SqlNodeParenthesis struct {
Expression SqlExpression `json:"expression"`
}
func (*SqlNodeParenthesis) GetValue ¶
func (this_ *SqlNodeParenthesis) GetValue(b *SqlBuilder) (res any)
type SqlNodeRelationalOperate ¶
type SqlNodeRelationalOperate struct {
Left SqlExpression `json:"left"`
// 比较(关系)运算符: == != > < >= <=
Operator string `json:"operator"`
Right SqlExpression `json:"right"`
}
SqlNodeRelationalOperate 比较(关系)运算: == != > < >= <=
func (*SqlNodeRelationalOperate) GetValue ¶
func (this_ *SqlNodeRelationalOperate) GetValue(b *SqlBuilder) (res any)
type SqlNodeSelect ¶
type SqlNodeSelect struct {
*SqlNodeBlock
}
type SqlNodeSql ¶
type SqlNodeSql struct {
// 是 读取
IsQuery bool `json:"isQuery,omitempty"`
// 是 插入
IsInsert bool `json:"isInsert,omitempty"`
// 是 插入
IsUpdate bool `json:"isUpdate,omitempty"`
// 是 插入
IsDelete bool `json:"isDelete,omitempty"`
// 是 插入
IsDDL bool `json:"isDDL,omitempty"`
// 是 其它语句
IsOther bool `json:"isOther,omitempty"`
Root SqlNode `json:"root"`
}
func (*SqlNodeSql) Append ¶
func (this_ *SqlNodeSql) Append(b *SqlBuilder)
func (*SqlNodeSql) GetSqlByMap ¶
func (this_ *SqlNodeSql) GetSqlByMap(handler SqlHandler, data map[string]any) (sqlInfo string, args []any)
type SqlNodeString ¶
type SqlNodeString struct {
Value string `json:"value"`
}
func ToSqlNodeString ¶
func ToSqlNodeString(str string) (res *SqlNodeString)
func (*SqlNodeString) Append ¶
func (this_ *SqlNodeString) Append(b *SqlBuilder)
func (*SqlNodeString) GetValue ¶
func (this_ *SqlNodeString) GetValue(b *SqlBuilder) (res any)
type SqlNodeTernary ¶
type SqlNodeTernary struct {
Test SqlExpression `json:"test"`
Left SqlExpression `json:"left"`
Right SqlExpression `json:"right"`
}
SqlNodeTernary 三元运算
func (*SqlNodeTernary) GetValue ¶
func (this_ *SqlNodeTernary) GetValue(b *SqlBuilder) (res any)
type SqlNodeText ¶
type SqlNodeText struct {
Text string
}
func (*SqlNodeText) Append ¶
func (this_ *SqlNodeText) Append(b *SqlBuilder)
type SqlNodeUpdate ¶
type SqlNodeUpdate struct {
*SqlNodeBlock
}
type SqlOption ¶
type SqlOption struct {
WrapOption
}
func NewSqlOption ¶
func NewSqlOption() (res *SqlOption)
func (*SqlOption) RealTableName ¶
func (*SqlOption) WrapColumnName ¶
type SqlParam ¶
type SqlParam struct {
// contains filtered or unexported fields
}
func NewMapSqlParam ¶
func NewMapSqlParam() (res *SqlParam)
func SqlParamByData ¶
func SqlParamByMap ¶
func (*SqlParam) GetObjectField ¶
func (*SqlParam) GetStringParam ¶
type SqlParamParser ¶
type SqlParamParser struct {
NotParseArg bool // 不是 不解析参数值 只解析SQL
ParamBefore string
ParamAfter string
// contains filtered or unexported fields
}
func NewSqlParamParser ¶
func NewSqlParamParser(sqlInfo string, param any) (res *SqlParamParser)
func (*SqlParamParser) Append ¶
func (this_ *SqlParamParser) Append(sql string, param any) *SqlParamParser
func (*SqlParamParser) GetParamData ¶
func (this_ *SqlParamParser) GetParamData(param any) (data map[string]any)
func (*SqlParamParser) Parse ¶
func (this_ *SqlParamParser) Parse() (res string, args []any, err error)
func (*SqlParamParser) ParseInfo ¶
func (this_ *SqlParamParser) ParseInfo() (info *SqlParamParserInfo, err error)
type SqlParamParserInfo ¶
type SqlReader ¶
func NewSqlReader ¶
func (*SqlReader) NextByCharEnd ¶
func (*SqlReader) NextHasChar ¶
func (this_ *SqlReader) NextHasChar()
type SqlSelect ¶
type SqlSelect struct {
// 模型 设置 如:表名、主键、包含字段、忽略字段、空值设置 等
*ModelSetting
// contains filtered or unexported fields
}
func (*SqlSelect) CanSelectAll ¶ added in v1.0.4
CanSelectAll 查询时候 必须 设置条件 除非 设置 CanSelectAll
func (*SqlSelect) SetWhere ¶
func (this_ *SqlSelect) SetWhere(where *Conditions) *SqlSelect
func (*SqlSelect) Where ¶
func (this_ *SqlSelect) Where() *Conditions
type SqlTemplate ¶
type SqlTemplate struct {
SqlList []*SqlNodeSql
// 中括号 可选 内容 是否
BracketOptional bool
// 设置 Debug 表示输出日志
Debug bool
// contains filtered or unexported fields
}
SqlTemplate SQL 模板语句 将 SQL 解析为 普通语句、参数替换语句、参数占位语句、if 语句 等 ${xx}: 参数占位语句,拼接SQL 为 ? 然后拼接参数 #{xx}和{xx}: 参数替换语句,直接将 参数 拼接SQL {xx}: 参数替换语句,直接将 参数 替换 if(xx){xxx}: 条件 [ss {x}]: BracketOptional = true,非必须,有参数情况,如果有 x 这个参数 则拼接 [ss ss dfd]: BracketOptional = true,非必须,无参数情况,如果参数有 ssSsDfd 则拼接
func NewSqlTemplate ¶
func NewSqlTemplate(sqlList ...string) (t *SqlTemplate)
func (*SqlTemplate) Append ¶
func (this_ *SqlTemplate) Append(sqlList ...string) *SqlTemplate
func (*SqlTemplate) GetSql ¶
func (this_ *SqlTemplate) GetSql(handler SqlHandler, param map[string]any) (sqlInfo string, sqlArgs []any)
func (*SqlTemplate) GetSqlHandler ¶
func (this_ *SqlTemplate) GetSqlHandler() SqlHandler
func (*SqlTemplate) GetSqlList ¶
func (this_ *SqlTemplate) GetSqlList(handler SqlHandler, param map[string]any) (sqlList []string, sqlArgsList [][]any)
func (*SqlTemplate) GetTemplateSql ¶
func (this_ *SqlTemplate) GetTemplateSql() (str string)
func (*SqlTemplate) Parse ¶
func (this_ *SqlTemplate) Parse() (err error)
func (*SqlTemplate) ParseSql ¶
func (this_ *SqlTemplate) ParseSql(r *SqlReader) (res *SqlNodeSql, err error)
func (*SqlTemplate) ParseSqlList ¶
func (this_ *SqlTemplate) ParseSqlList(str string) (res []*SqlNodeSql, err error)
func (*SqlTemplate) SetSqlHandler ¶
func (this_ *SqlTemplate) SetSqlHandler(sqlHandler SqlHandler) *SqlTemplate
type SqlUpdate ¶
type SqlUpdate struct {
// 模型 设置 如:表名、主键、包含字段、忽略字段、空值设置 等
*ModelSetting
// contains filtered or unexported fields
}
func (*SqlUpdate) CanUpdateAll ¶ added in v1.0.4
CanUpdateAll 更新时候 必须 设置条件 除非 设置 CanUpdateAll
func (*SqlUpdate) SetWhere ¶
func (this_ *SqlUpdate) SetWhere(where *Conditions) *SqlUpdate
func (*SqlUpdate) Where ¶
func (this_ *SqlUpdate) Where() *Conditions
type SqlUpdateSet ¶ added in v1.0.4
type SqlUpdateSet = func(in *SqlUpdate)
type StringType ¶
type StringType interface {
String() string
}
type Table ¶
type Table struct {
DatabaseName string `json:"databaseName,omitempty"`
SchemaName string `json:"schemaName,omitempty"`
Name string `json:"name,omitempty"`
Comment string `json:"comment,omitempty"`
AutoIncrement bool `json:"autoIncrement,omitempty"`
AutoIncrementStart int64 `json:"autoIncrementStart,omitempty"`
AutoIncrementName string `json:"autoIncrementName,omitempty"`
AutoIncrementCreate bool `json:"autoIncrementCreate,omitempty"`
ColumnList []*Column `json:"columnList,omitempty"`
ConstraintList []*Constraint `json:"constraintList,omitempty"`
IndexList []*Index `json:"indexList,omitempty"`
IfNotExists bool `json:"ifNotExists,omitempty"`
// 扩展属性
Extend map[string]any `json:"extend,omitempty"`
}
func TableByMap ¶
func (*Table) FindColumn ¶
type User ¶
type WhereOperator ¶
type WrapOption ¶
type WrapOption struct {
// 是否 包装 名称
WrapNameOpen *bool `json:"wrapNameOpen,omitempty"`
// 包装 名称 的字符
WrapNameChar *string `json:"wrapNameChar,omitempty"`
// 是否 包装 表名称 该配置 > NameWrap
WrapTableNameOpen *bool `json:"wrapTableNameOpen,omitempty"`
// 是否 包装 字段名称 该配置 > NameWrap
WrapColumnNameOpen *bool `json:"wrapColumnNameOpen,omitempty"`
// 包装 字符串的 字符
WrapStringChar *string `json:"wrapStringChar,omitempty"`
}
func (WrapOption) IsWrapColumnName ¶
func (this_ WrapOption) IsWrapColumnName() bool
func (WrapOption) IsWrapName ¶
func (this_ WrapOption) IsWrapName() bool
func (WrapOption) IsWrapTableName ¶
func (this_ WrapOption) IsWrapTableName() bool
func (WrapOption) Names ¶
func (this_ WrapOption) Names(names []string) (res string)
func (WrapOption) Set ¶
func (this_ WrapOption) Set(fn func(o WrapOption)) WrapOption
func (WrapOption) WrapColumnName ¶
func (this_ WrapOption) WrapColumnName(name string) string
func (WrapOption) WrapName ¶
func (this_ WrapOption) WrapName(name string) (res string)
func (WrapOption) WrapNames ¶
func (this_ WrapOption) WrapNames(names []string) (res string)
func (WrapOption) WrapString ¶
func (this_ WrapOption) WrapString(str string) (res string)
func (WrapOption) WrapTableName ¶
func (this_ WrapOption) WrapTableName(name string) string