sqlite3

package
v0.0.0-...-90299f3 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: GPL-3.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	OPEN_MODE_READ_ONLY         = "ro"
	OPEN_MODE_READ_WRITE        = "rw"
	OPEN_MODE_READ_WRITE_CREATE = "rwc"
	OPEN_MODE_MEMORY            = "memory"
	CACHE_MODE_SHARED           = "shared"
	CACHE_MODE_PRIVATE          = "private"
	SYNC_MODE_OFF               = 0
	SYNC_MODE_NORMAL            = 1
	SYNC_MODE_FULL              = 2
	SYNC_MODE_EXTRA             = 3
)

Variables

This section is empty.

Functions

func MapCurrent

func MapCurrent(v map[string]interface{}) interface{}

func MapKey

func MapKey(v map[string]interface{}) string

Types

type ActiveRecord

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

func (*ActiveRecord) Cache

func (ar *ActiveRecord) Cache(key string, seconds uint) *ActiveRecord

func (*ActiveRecord) Delete

func (ar *ActiveRecord) Delete(table string, where map[string]interface{}) *ActiveRecord

func (*ActiveRecord) From

func (ar *ActiveRecord) From(from string) *ActiveRecord

func (*ActiveRecord) FromAs

func (ar *ActiveRecord) FromAs(from, as string) *ActiveRecord

func (*ActiveRecord) GroupBy

func (ar *ActiveRecord) GroupBy(column string) *ActiveRecord

func (*ActiveRecord) Having

func (ar *ActiveRecord) Having(having string) *ActiveRecord

func (*ActiveRecord) HavingWrap

func (ar *ActiveRecord) HavingWrap(having, leftWrap, rightWrap string) *ActiveRecord

func (*ActiveRecord) Insert

func (ar *ActiveRecord) Insert(table string, data map[string]interface{}) *ActiveRecord

func (*ActiveRecord) InsertBatch

func (ar *ActiveRecord) InsertBatch(table string, data []map[string]interface{}) *ActiveRecord

func (*ActiveRecord) Join

func (ar *ActiveRecord) Join(table, as, on, type_ string) *ActiveRecord

func (*ActiveRecord) Limit

func (ar *ActiveRecord) Limit(limit ...int) *ActiveRecord

Limit Limit(offset,count) or Limit(count)

func (*ActiveRecord) OrderBy

func (ar *ActiveRecord) OrderBy(column, type_ string) *ActiveRecord

func (*ActiveRecord) Raw

func (ar *ActiveRecord) Raw(sql string, values ...interface{}) *ActiveRecord

func (*ActiveRecord) Replace

func (ar *ActiveRecord) Replace(table string, data map[string]interface{}) *ActiveRecord

func (*ActiveRecord) ReplaceBatch

func (ar *ActiveRecord) ReplaceBatch(table string, data []map[string]interface{}) *ActiveRecord

func (*ActiveRecord) Reset

func (ar *ActiveRecord) Reset()

func (*ActiveRecord) SQL

func (ar *ActiveRecord) SQL() string

func (*ActiveRecord) Select

func (ar *ActiveRecord) Select(columns string) *ActiveRecord

func (*ActiveRecord) SelectNoWrap

func (ar *ActiveRecord) SelectNoWrap(columns string) *ActiveRecord

func (*ActiveRecord) Set

func (ar *ActiveRecord) Set(column string, value interface{}) *ActiveRecord

func (*ActiveRecord) SetNoWrap

func (ar *ActiveRecord) SetNoWrap(column string, value interface{}) *ActiveRecord

func (*ActiveRecord) Update

func (ar *ActiveRecord) Update(table string, data, where map[string]interface{}) *ActiveRecord

func (*ActiveRecord) UpdateBatch

func (ar *ActiveRecord) UpdateBatch(table string, values []map[string]interface{}, whereColumn []string) *ActiveRecord

func (*ActiveRecord) Values

func (ar *ActiveRecord) Values() []interface{}

func (*ActiveRecord) Where

func (ar *ActiveRecord) Where(where map[string]interface{}) *ActiveRecord

func (*ActiveRecord) WhereWrap

func (ar *ActiveRecord) WhereWrap(where map[string]interface{}, leftWrap, rightWrap string) *ActiveRecord

func (*ActiveRecord) Wrap

func (ar *ActiveRecord) Wrap(v string) string

type Cache

type Cache interface {
	Set(key string, val []byte, expire uint) (err error)
	Get(key string) (data []byte, err error)
}

type DB

type DB struct {
	Config   DBConfig
	ConnPool *sql.DB
	DSN      string
}

func NewDB

func NewDB(config DBConfig) (db DB, err error)

func (*DB) AR

func (db *DB) AR() (ar *ActiveRecord)

func (*DB) Begin

func (db *DB) Begin() (tx *sql.Tx, err error)

func (*DB) Exec

func (db *DB) Exec(ar *ActiveRecord) (rs *ResultSet, err error)

func (*DB) ExecSQL

func (db *DB) ExecSQL(sqlStr string, values ...interface{}) (rs *ResultSet, err error)

func (*DB) ExecSQLTx

func (db *DB) ExecSQLTx(tx *sql.Tx, sqlStr string, values ...interface{}) (rs *ResultSet, err error)

func (*DB) ExecTx

func (db *DB) ExecTx(ar *ActiveRecord, tx *sql.Tx) (rs *ResultSet, err error)

func (*DB) Query

func (db *DB) Query(ar *ActiveRecord) (rs *ResultSet, err error)

type DBConfig

type DBConfig struct {
	Database                 string
	TablePrefix              string
	TablePrefixSqlIdentifier string
	Cache                    Cache
	SyncMode                 int
	OpenMode                 string
	CacheMode                string
	Password                 string
}

func NewDBConfig

func NewDBConfig() DBConfig

func NewDBConfigWith

func NewDBConfigWith(dbfilename, password, openMode, cacheMode string, syncMode int) (cfg DBConfig)

type DBGroup

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

func NewDBGroup

func NewDBGroup(defaultConfigName string) (group *DBGroup)

func NewDBGroupCache

func NewDBGroupCache(defaultConfigName string, cache Cache) (group *DBGroup)

func (*DBGroup) DB

func (g *DBGroup) DB(name ...string) (db *DB)

func (*DBGroup) Regist

func (g *DBGroup) Regist(name string, cfg DBConfig) (err error)

func (*DBGroup) RegistGroup

func (g *DBGroup) RegistGroup(cfg map[string]DBConfig) (err error)

type ResultSet

type ResultSet struct {
	LastInsertId int64
	RowsAffected int64
	// contains filtered or unexported fields
}

func (*ResultSet) Init

func (rs *ResultSet) Init(rawRows *[]map[string][]byte)

func (*ResultSet) Len

func (rs *ResultSet) Len() int

func (*ResultSet) MapRows

func (rs *ResultSet) MapRows(keyColumn string) (rowsMap map[string]map[string]string)

func (*ResultSet) MapStructs

func (rs *ResultSet) MapStructs(keyColumn string, strucT interface{}) (structsMap map[string]interface{}, err error)

func (*ResultSet) MapValues

func (rs *ResultSet) MapValues(keyColumn, valueColumn string) (values map[string]string)

func (*ResultSet) Row

func (rs *ResultSet) Row() (row map[string]string)

func (*ResultSet) Rows

func (rs *ResultSet) Rows() (rows []map[string]string)

func (*ResultSet) Struct

func (rs *ResultSet) Struct(strucT interface{}) (Struct interface{}, err error)

func (*ResultSet) Structs

func (rs *ResultSet) Structs(strucT interface{}) (structs []interface{}, err error)

func (*ResultSet) Value

func (rs *ResultSet) Value(column string) (value string)

func (*ResultSet) Values

func (rs *ResultSet) Values(column string) (values []string)

Jump to

Keyboard shortcuts

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