Documentation ¶
Index ¶
- type Config
- type Store
- func (store *Store) Close() error
- func (store *Store) Exists(modelPtr interface{}, whereQuery string, args ...interface{}) (bool, error)
- func (store *Store) GetById(modelPtr interface{}, id uint64) (bool, error)
- func (store *Store) List(db *gorm.DB, idDesc bool, offset, limit int, slicePtr interface{}) (total int64, err error)
- func (*Store) ListByOrder(db *gorm.DB, orderBy string, offset, limit int, slicePtr interface{}) (total int64, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Host string `default:"127.0.0.1:3306"` Username string `default:"root"` Password string Database string ConnMaxLifetime time.Duration `default:"3m"` MaxOpenConns int `default:"10"` MaxIdleConns int `default:"10"` LogLevel string `default:"warn"` SlowThreshold time.Duration `default:"200ms"` }
func MustNewConfigFromViper ¶
func MustNewConfigFromViper() Config
func (*Config) MustCreateDatabaseIfAbsent ¶
func (*Config) MustOpenOrCreate ¶
MustOpenOrCreate creates an instance of store or exits on any error.
Click to show internal directories.
Click to hide internal directories.