Documentation ¶
Index ¶
- func List(db *gorm.DB, idDESC bool, offset, limit int, destSlice interface{}) (total int64, err error)
- func ListByOrder(db *gorm.DB, orderBy string, offset, limit int, destSlice interface{}) (total int64, err error)
- type Config
- type Crud
- func (crud *Crud) Exists(modelPtr interface{}, whereQuery string, args ...interface{}) (bool, error)
- func (crud *Crud) Get(modelPtr interface{}, whereQuery string, args ...interface{}) error
- func (crud *Crud) GetById(modelPtr interface{}, id uint64) error
- func (crud *Crud) List(db *gorm.DB, idDESC bool, offset, limit int, destSlice interface{}) (total int64, err error)
- func (*Crud) ListByOrder(db *gorm.DB, orderBy string, offset, limit int, destSlice interface{}) (total int64, err error)
- func (crud *Crud) RequireAbsent(modelPtr interface{}, whereQuery string, args ...interface{}) error
- type SqliteStore
- func (ms *SqliteStore) Close() error
- func (ms *SqliteStore) GetBill(app, addr string, status int) (*model.Bill, bool, error)
- func (ms *SqliteStore) GetBillFee(app, addr string) (*big.Int, error)
- func (ms *SqliteStore) IsRecordNotFound(err error) bool
- func (ms *SqliteStore) UpsertBill(tx *gorm.DB, app, addr string, fee *big.Int) (*model.Bill, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Database string `default:"file::memory:?cache=shared"` // For shared memory sqlite instance, never expire the connection otherwise // the memory db may be released once no connection existed. ConnMaxLifetime time.Duration `default:"0"` MaxOpenConns int `default:"10"` MaxIdleConns int `default:"10"` }
Config represents the sqlite configurations to open a database instance.
func MustNewConfigFromViper ¶
func MustNewConfigFromViper() Config
MustNewConfigFromViper creates an instance of Config from Viper.
func (*Config) MustOpenOrCreate ¶
func (config *Config) MustOpenOrCreate(tables ...interface{}) *SqliteStore
MustOpenOrCreate creates an instance of store or exits on any error.
type Crud ¶
type Crud struct {
// contains filtered or unexported fields
}
func NewCrud ¶
func NewCrud(store *SqliteStore, errEntityNotFound, errEntityAlreadyExists error) *Crud
func (*Crud) ListByOrder ¶
func (*Crud) RequireAbsent ¶
type SqliteStore ¶
func MustNewStoreFromViper ¶
func MustNewStoreFromViper(tables ...interface{}) *SqliteStore
func NewSqliteStore ¶
func NewSqliteStore(db *gorm.DB) *SqliteStore
func (*SqliteStore) Close ¶
func (ms *SqliteStore) Close() error
func (*SqliteStore) GetBillFee ¶
func (ms *SqliteStore) GetBillFee(app, addr string) (*big.Int, error)
func (*SqliteStore) IsRecordNotFound ¶
func (ms *SqliteStore) IsRecordNotFound(err error) bool
Click to show internal directories.
Click to hide internal directories.