Documentation
¶
Index ¶
- Variables
- func IsErrorNotFound(err error) bool
- func Migrate(db *DB) error
- func RegisterMigrate(fn MigrateFunc)
- type Config
- type DB
- func (db *DB) Begin() *DB
- func (db *DB) Close() error
- func (db *DB) Commit() error
- func (db *DB) Debug() *DB
- func (db *DB) Ping() error
- func (db *DB) Rollback() error
- func (db *DB) RollbackUnlessCommitted()
- func (db *DB) Tx(fn func(tx *DB) error) error
- func (db *DB) Update() *gorm.DB
- func (db *DB) View() *gorm.DB
- type MigrateFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrOptimisticLock = errors.New("optimistic Lock Error")
ErrOptimisticLock is returned by if the struct being modified has a Version field and the value is not equal to the current value in the database
View Source
var ErrRecordNotFound = gorm.ErrRecordNotFound
Functions ¶
func IsErrorNotFound ¶
func RegisterMigrate ¶
func RegisterMigrate(fn MigrateFunc)
Types ¶
type Config ¶
type Config struct { Dialect string `json:"dialect"` // mysql,postgres,sqlite3 Host string `json:"host"` // if Dialect is `sqlite3`, host should be db file path ReadHost string `json:"read_host"` Port int `json:"port"` User string `json:"user"` Password string `json:"password"` Database string `json:"database"` Location string `json:"location,omitempty"` Debug bool `json:"debug,omitempty"` }
func SqliteInMemory ¶
func SqliteInMemory() Config
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) RollbackUnlessCommitted ¶
func (db *DB) RollbackUnlessCommitted()
type MigrateFunc ¶
Click to show internal directories.
Click to hide internal directories.