Documentation
¶
Index ¶
- func DestroyOperation(op *Operations) error
- type Config
- type Operations
- func (op *Operations) AutoMigrate(tables ...Table) error
- func (op *Operations) BeginTransaction() *Operations
- func (op *Operations) CommitTransaction()
- func (op *Operations) ExecuteRawSql(sqlStr string, args ...any) ([]sql.Result, error)
- func (op *Operations) ExecuteRawSqlTemplate(sqlStr string, executeParams map[string]any, args ...any) ([]sql.Result, error)
- func (op *Operations) ExecuteRawSqlTemplateWithRowsAffected(sqlStr string, executeParams map[string]any, args ...any) ([]sql.Result, int64, error)
- func (op *Operations) ExecuteRawSqlWithRowsAffected(sqlStr string, args ...any) ([]sql.Result, int64, error)
- func (op *Operations) RollbackTransaction()
- type Table
- type TableColumn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DestroyOperation ¶
func DestroyOperation(op *Operations) error
Types ¶
type Config ¶
type Config struct {
UserName string `json:"user_name" yaml:"user_name"`
Password string `json:"password" yaml:"password"`
Address string `json:"address" yaml:"address"`
Port string `json:"port" yaml:"port"`
Database string `json:"database" yaml:"database"`
MaxConnections int `json:"max_connections" yaml:"max_connections"`
MaxIdleConnections int `json:"max_idle_connections" yaml:"max_idle_connections"`
LogLevel string `json:"log_level" yaml:"log_level"`
}
type Operations ¶
type Operations struct {
// contains filtered or unexported fields
}
func NewOperations ¶
func NewOperations(dbConfig *Config) (*Operations, error)
func (*Operations) AutoMigrate ¶
func (op *Operations) AutoMigrate(tables ...Table) error
func (*Operations) BeginTransaction ¶
func (op *Operations) BeginTransaction() *Operations
func (*Operations) CommitTransaction ¶
func (op *Operations) CommitTransaction()
func (*Operations) ExecuteRawSql ¶
func (*Operations) ExecuteRawSqlTemplate ¶ added in v0.11.1
func (*Operations) ExecuteRawSqlTemplateWithRowsAffected ¶ added in v1.5.3
func (*Operations) ExecuteRawSqlWithRowsAffected ¶ added in v1.5.3
func (*Operations) RollbackTransaction ¶
func (op *Operations) RollbackTransaction()
type Table ¶
type Table struct {
TableName string
Columns []TableColumn
}
type TableColumn ¶
type TableColumn struct {
Name string
Type string
Comment string
PrimaryKey bool
Size int
Unique bool
NotNull bool
Index bool
UniqueIndex string
Default any
}
func (*TableColumn) ToDBModelField ¶
func (column *TableColumn) ToDBModelField() (*reflect.StructField, error)
Click to show internal directories.
Click to hide internal directories.