Documentation ¶
Index ¶
- Variables
- func CreateMigrationTableIfNotExists(db *xorm.Engine, options *migrate.Options) error
- func GetEngine() *xorm.Engine
- func InitEngine(driver, dataSource string, showSQL bool, migrationPath string) error
- func NewSession() *xorm.Session
- func ReadMigrationDir(dir string) ([]*migrate.Migration, error)
- func ThrowDBError(err error)
- type CommonDBA
- func (commonDBA *CommonDBA) DeleteByID(session *xorm.Session, id int, record interface{}) int64
- func (commonDBA *CommonDBA) InsertMany(session *xorm.Session, records interface{}) int64
- func (commonDBA *CommonDBA) InsertOne(session *xorm.Session, record interface{}) int64
- func (commonDBA *CommonDBA) Run(fn func(session *xorm.Session) error) (result error)
- func (commonDBA *CommonDBA) RunInTransaction(fn func(session *xorm.Session) error) (result error)
- func (commonDBA *CommonDBA) UpdateByID(session *xorm.Session, id int, record interface{}) int64
- type GonicLowerCaseMapper
- type GonicLowerCasePluralizeMapper
- type GonicUpperCaseMapper
- type GonicUpperCasePluralizeMapper
- type HandledDBError
Constants ¶
This section is empty.
Variables ¶
var LintGonicLowerCaseMapper = GonicLowerCaseMapper{ // contains filtered or unexported fields }
LintGonicLowerCaseMapper lists of commonly used acronyms
var LintGonicLowerCasePluralizeMapper = GonicLowerCasePluralizeMapper{ // contains filtered or unexported fields }
LintGonicLowerCasePluralizeMapper lists of commonly used acronyms
var LintGonicUpperCaseMapper = GonicUpperCaseMapper{ // contains filtered or unexported fields }
LintGonicUpperCaseMapper lists of commonly used acronyms
var LintGonicUpperCasePluralizeMapper = GonicUpperCasePluralizeMapper{ // contains filtered or unexported fields }
LintGonicUpperCasePluralizeMapper lists of commonly used acronyms
Functions ¶
func CreateMigrationTableIfNotExists ¶
CreateMigrationTableIfNotExists は migration テーブルを作成する. xorm.migrate.createMigrationTableIfNotExists は ROW_FORMAT を指定できないので使わない.
func InitEngine ¶
InitEngine は xorm engine の初期化を行う.
func ReadMigrationDir ¶
ReadMigrationDir は dir から *.sql ファイルを読んで migration スライスを返す.
func ThrowDBError ¶
func ThrowDBError(err error)
ThrowDBError は HandleDBError にラップした error を panic に渡す.
Types ¶
type CommonDBA ¶
type CommonDBA struct {
// contains filtered or unexported fields
}
CommonDBA is commonDBA of User.
func (*CommonDBA) DeleteByID ¶
DeleteByID 指定されたフィールドを削除する.
func (*CommonDBA) InsertMany ¶
InsertMany Entity
func (*CommonDBA) RunInTransaction ¶
RunInTransaction does statements in db transaction.
type GonicLowerCaseMapper ¶
type GonicLowerCaseMapper struct {
// contains filtered or unexported fields
}
GonicLowerCaseMapper E.g. ID -> ID, USER -> User and to table names: UserID -> USER_ID, MyUID -> MY_UID
func (GonicLowerCaseMapper) Obj2Table ¶
func (mapper GonicLowerCaseMapper) Obj2Table(name string) string
Obj2Table provides Obj field -> Table column mapping.
func (GonicLowerCaseMapper) Table2Obj ¶
func (mapper GonicLowerCaseMapper) Table2Obj(name string) string
Table2Obj Provides Table column -> Obj field mapping.
type GonicLowerCasePluralizeMapper ¶
type GonicLowerCasePluralizeMapper struct {
// contains filtered or unexported fields
}
GonicLowerCasePluralizeMapper E.g. USERS -> user, COMPANIES -> Company and to table names: User -> users, CompanyAccount -> company_accounts
func (GonicLowerCasePluralizeMapper) Obj2Table ¶
func (mapper GonicLowerCasePluralizeMapper) Obj2Table(name string) string
Obj2Table provides Obj field -> Table column mapping.
func (GonicLowerCasePluralizeMapper) Table2Obj ¶
func (mapper GonicLowerCasePluralizeMapper) Table2Obj(name string) string
Table2Obj Provides Table column -> Obj field mapping.
type GonicUpperCaseMapper ¶
type GonicUpperCaseMapper struct {
// contains filtered or unexported fields
}
GonicUpperCaseMapper E.g. ID -> ID, USER -> User and to table names: UserID -> USER_ID, MyUID -> MY_UID
func (GonicUpperCaseMapper) Obj2Table ¶
func (mapper GonicUpperCaseMapper) Obj2Table(name string) string
Obj2Table provides Obj field -> Table column mapping.
func (GonicUpperCaseMapper) Table2Obj ¶
func (mapper GonicUpperCaseMapper) Table2Obj(name string) string
Table2Obj Provides Table column -> Obj field mapping.
type GonicUpperCasePluralizeMapper ¶
type GonicUpperCasePluralizeMapper struct {
// contains filtered or unexported fields
}
GonicUpperCasePluralizeMapper E.g. USERS -> User, COMPANIES -> Company and to table names: User -> USERS, CompanyAccount -> COMPANY_ACCOUNTS
func (GonicUpperCasePluralizeMapper) Obj2Table ¶
func (mapper GonicUpperCasePluralizeMapper) Obj2Table(name string) string
Obj2Table provides Obj field -> Table column mapping.
func (GonicUpperCasePluralizeMapper) Table2Obj ¶
func (mapper GonicUpperCasePluralizeMapper) Table2Obj(name string) string
Table2Obj Provides Table column -> Obj field mapping.
type HandledDBError ¶
type HandledDBError struct {
DBError error
}
HandledDBError represents a error reason by code and reason string.