sqlite

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package sqlite

@author: xwc1125

Package sqlite

@author: xwc1125

Package sqlite

@author: xwc1125

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB ...

func New

func New(config *SqliteConfig) (*DB, error)

New ...

func (*DB) DB

func (db *DB) DB() *sqlx.DB

DB ...

func (*DB) Delete

func (db *DB) Delete(sql string, args ...interface{}) (affect int64, err error)

Delete 删除

func (*DB) Insert

func (db *DB) Insert(sql string, args ...interface{}) (id int64, err error)

Insert 插入

func (*DB) Select

func (db *DB) Select(dest interface{}, sql string, args ...interface{}) error

Select 查询

func (*DB) Transaction

func (db *DB) Transaction(sqls []DBSql) (err error)

Transaction 事务处理

func (*DB) Update

func (db *DB) Update(sql string, args ...interface{}) (affect int64, err error)

Update 更新

type DBSql

type DBSql struct {
	Sql  string        `json:"sql" mapstructure:"sql"`
	Args []interface{} `json:"args" mapstructure:"args"`
}

type SqliteConfig

type SqliteConfig struct {
	Datasource      string `json:"datasource" mapstructure:"datasource"`
	MaxIdleConns    int    `json:"max_idle_conns" mapstructure:"max_idle_conns"`
	MaxOpenConns    int    `json:"max_open_conns" mapstructure:"max_open_conns"`
	ConnMaxLifetime int    `json:"conn_max_lifetime" mapstructure:"conn_max_lifetime"`
	ConnMaxIdleTime int    `json:"conn_max_idle_time" mapstructure:"conn_max_idle_time"`
}

Jump to

Keyboard shortcuts

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