data

package
v0.0.0-...-c25c7fd Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBPool

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

func GetDBPool

func GetDBPool(dsn string, maxOpenConns, maxIdleConns int, connMaxLifetime time.Duration) (*DBPool, error)

func (*DBPool) Close

func (p *DBPool) Close() error

func (*DBPool) Delete

func (p *DBPool) Delete(query string, args ...interface{}) error

func (*DBPool) Insert

func (p *DBPool) Insert(query string, args ...interface{}) (int64, error)

func (*DBPool) Query

func (p *DBPool) Query(query string, args ...interface{}) (*sql.Rows, error)

func (*DBPool) Update

func (p *DBPool) Update(query string, args ...interface{}) error

type SqliteDB

type SqliteDB struct {
	Connection *sql.DB
}

SqliteDB represents the SQLite database

func NewSqliteDB

func NewSqliteDB() *SqliteDB

NewSqliteDB initializes a new instance of the SqliteDB struct

func (*SqliteDB) Begin

func (db *SqliteDB) Begin() (*sql.Tx, error)

func (*SqliteDB) Close

func (db *SqliteDB) Close() error

Close closes the database connection

func (*SqliteDB) Delete

func (db *SqliteDB) Delete(query string, args ...interface{}) (sql.Result, error)

Delete executes a delete statement

func (*SqliteDB) Exec

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

func (*SqliteDB) Insert

func (db *SqliteDB) Insert(query string, args ...interface{}) (sql.Result, error)

Insert inserts data into the specified table

func (*SqliteDB) Open

func (db *SqliteDB) Open() error

func (*SqliteDB) Prepare

func (db *SqliteDB) Prepare(query string) (*sql.Stmt, error)

func (*SqliteDB) Query

func (db *SqliteDB) Query(query string, args ...interface{}) (*sql.Rows, error)

Query executes a query and returns rows

func (*SqliteDB) QueryRow

func (db *SqliteDB) QueryRow(query string, args ...interface{}) (*sql.Row, error)

QueryRow executes a query that is expected to return at most one row

func (*SqliteDB) Update

func (db *SqliteDB) Update(query string, args ...interface{}) (sql.Result, error)

Update executes an update statement

Jump to

Keyboard shortcuts

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