stores

package
v0.0.0-...-0fb516e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

============================================================ 描述: 作者: Simon 日期: 2019/10/25 12:04 下午

============================================================

Index

Constants

View Source
const (
	MysqlDialect = "mysql"
)

Variables

This section is empty.

Functions

func GetSqlStruct

func GetSqlStruct(bean interface{}) (*sqlStruct, error)

Types

type DBStoreConf

type DBStoreConf struct {
	IP       string `json:"ip" yaml:"ip"`
	Port     string `json:"port" yaml:"port"`
	User     string `json:"user" yaml:"user"`
	Password string `json:"password" yaml:"password"`
	DBName   string `json:"dbName" yaml:"dbName"`
	Idle     int    `json:"idle" yaml:"idle"`
	Active   int    `json:"active" yaml:"active"`
}

type MSStore

type MSStore struct {
	*sqlx.DB
}

MSStore sql server Store

func NewMSStore

func NewMSStore(conf *DBStoreConf) *MSStore

func (*MSStore) Insert

func (ms *MSStore) Insert(tx *sql.Tx, bean interface{}) error

Insert 带事务保存

func (*MSStore) Insertx

func (ms *MSStore) Insertx(tx *sql.Tx, beans ...interface{}) error

Insert 批量保存

func (*MSStore) QueryPageWithOffset

func (ms *MSStore) QueryPageWithOffset(dest interface{}, query string, page, size int, args ...interface{}) (*rs.PageData, error)

func (*MSStore) Update

func (ms *MSStore) Update(tx *sql.Tx, bean interface{}) error

func (*MSStore) Updatex

func (ms *MSStore) Updatex(tx *sql.Tx, beans ...interface{}) error

type MyStore

type MyStore struct {
	// contains filtered or unexported fields
}

func NewMyStore

func NewMyStore(conf *DBStoreConf) *MyStore

func (*MyStore) BeginTx

func (m *MyStore) BeginTx() (*sql.Tx, error)

func (*MyStore) Commit

func (m *MyStore) Commit(tx *sql.Tx) error

func (*MyStore) Exec

func (m *MyStore) Exec(query string, args ...interface{}) (sql.Result, error)

func (*MyStore) ExecTx

func (m *MyStore) ExecTx(tx *sql.Tx, query string, args ...interface{}) (sql.Result, error)

func (*MyStore) Get

func (m *MyStore) Get(dest interface{}, sql string, args ...interface{}) error

func (*MyStore) Insert

func (m *MyStore) Insert(bean interface{}) error

func (*MyStore) InsertTx

func (m *MyStore) InsertTx(tx *sql.Tx, bean interface{}) error

func (*MyStore) Insertx

func (m *MyStore) Insertx(bean ...interface{}) error

func (*MyStore) Query

func (m *MyStore) Query(dest interface{}, sql string, args ...interface{}) error

func (*MyStore) QueryPage

func (m *MyStore) QueryPage(dest interface{}, query string, page, size int, args ...interface{}) (*rs.PageData, error)

func (*MyStore) RollBack

func (m *MyStore) RollBack(tx *sql.Tx) error

func (*MyStore) Update

func (m *MyStore) Update(bean interface{}) error

func (*MyStore) UpdateTx

func (m *MyStore) UpdateTx(tx *sql.Tx, bean interface{}) error

func (*MyStore) Updatex

func (m *MyStore) Updatex(bean ...interface{}) error

type PageData

type PageData struct {
}

type RedisConf

type RedisConf struct {
	Addr   string `json:"addr" yaml:"addr"`
	DB     int    `json:"db" yaml:"db"`
	Idle   int    `json:"idle" yaml:"idle"`
	Active int    `json:"active" yaml:"active"`
}

type RedisStore

type RedisStore struct {
	*redis.Pool
}

RedisStorage redis 操作类

func NewRedisStore

func NewRedisStore(conf *RedisConf) *RedisStore

newRedisStorage 实例化redis

func (*RedisStore) Del

func (r *RedisStore) Del(key string) error

Del 删除Key

func (*RedisStore) Expire

func (r *RedisStore) Expire(key string, t time.Duration) error

Expire 设置过期时间

func (*RedisStore) GetValue

func (r *RedisStore) GetValue(key string, value interface{}) error

GetValue 获取值

func (*RedisStore) SetValue

func (r *RedisStore) SetValue(key string, value interface{}) error

SetValue 设置值

func (*RedisStore) SetValueWithTimeout

func (r *RedisStore) SetValueWithTimeout(key string, value interface{}, t time.Duration) error

type Table

type Table interface {
	TableName() string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL