db

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const LikeSign = "_like_"

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column string
const (
	ColumnHash      Column = "hash"
	ColumnType      Column = "type"
	ColumnAddress   Column = "address"
	ColumnSender    Column = "sender"
	ColumnReceiver  Column = "receiver"
	ColumnMessage   Column = "message"
	ColumnTimestamp Column = "timestamp"
	ColumnNoNeed    Column = ""
)

type DB

type DB interface {
	Create()
}

type DBSQL

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

func NewSQLDB

func NewSQLDB(cfg *config.Config) (*DBSQL, error)

func (*DBSQL) BatchCreate added in v1.1.1

func (s *DBSQL) BatchCreate(table TableName, cols []Column, vals [][]interface{}) error

func (*DBSQL) Close

func (s *DBSQL) Close() error

func (*DBSQL) Count

func (s *DBSQL) Count(table TableName, dest interface{}) error

func (*DBSQL) Create

func (s *DBSQL) Create(table TableName, condition map[Column]interface{}) error

func (*DBSQL) Delete

func (s *DBSQL) Delete(table TableName, condition map[Column]interface{}) error

func (*DBSQL) Group

func (s *DBSQL) Group(table TableName, column Column, dest interface{}) error

func (*DBSQL) NewTransaction added in v1.2.0

func (s *DBSQL) NewTransaction() *sqlx.Tx

func (*DBSQL) Read

func (s *DBSQL) Read(table TableName, condition map[Column]interface{}, offset int, limit int, order Column, dest interface{}) error

func (*DBSQL) Update

func (s *DBSQL) Update(table TableName, condition map[Column]interface{}) error

type DbStore

type DbStore interface {
	io.Closer
	NewTransaction() *sqlx.Tx
	Create(table TableName, condition map[Column]interface{}) error
	BatchCreate(table TableName, cols []Column, vals [][]interface{}) error
	Read(table TableName, condition map[Column]interface{}, offset int, limit int, order Column, dest interface{}) error
	Update(table TableName, condition map[Column]interface{}) error
	Delete(table TableName, condition map[Column]interface{}) error
	Count(table TableName, dest interface{}) error
	Group(table TableName, column Column, dest interface{}) error
}

type TableName

type TableName string
const (
	TableBlockHash    TableName = "blockhash"
	TableBlockMessage TableName = "blockmessage"
)

Jump to

Keyboard shortcuts

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