sqlite

package
v0.0.0-...-c914e5a Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Db

type Db struct {
	*goqu.Database
	// contains filtered or unexported fields
}

Db wraps goqu.Database to expose a Close method for the underlying database driver

func NewDb

func NewDb(name string) (db *Db, err error)

NewDb creates a new Db

func (*Db) Close

func (db *Db) Close() (err error)

Close closes the database driver

func (*Db) CreateTable

func (db *Db) CreateTable(name string, schema Schema) (err error)

CreateTable creates a table

func (*Db) DeleteRowsByID

func (db *Db) DeleteRowsByID(table string, idCol string, ids ...interface{}) (numDeletedRows int64, err error)

DeleteRowsByID deletes rows from a table by their ids

func (*Db) InsertRows

func (db *Db) InsertRows(table string, rows []interface{}) (numInsertedRows int64, lastID int64, err error)

InsertRows inserts rows into a table

type DbType

type DbType string

DbType is a sqlite3 data type

const (
	DbInteger DbType = "INTEGER"
	DbFloat   DbType = "REAL"
	DbString  DbType = "TEXT"
)

sqlite3 data types

type Schema

type Schema map[string]string

Schema represents a table's schema as a map of column name to type

func (Schema) String

func (sc Schema) String() (st string)

Jump to

Keyboard shortcuts

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