sqlitedb

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StatementCreateOutputParsingTable

func StatementCreateOutputParsingTable() (string, string)

StatementCreateOutputParsingTable returns a statement to create a table and the table name.

Types

type DB

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

func NewMemDB

func NewMemDB() (*DB, error)

NewMemDB create a new sqlite db in memory.

func (*DB) Close

func (d *DB) Close() error

Close close the db.

func (*DB) CreateTable

func (d *DB) CreateTable(ctx context.Context, get func() (string, string)) (Table, error)

CreateTable create a table with given statement, the get() method will returns the create statement and the table name.

type Table

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

Table represents a table in sqlite db.

func (*Table) Delete

func (t *Table) Delete(ctx context.Context, where string) error

Delete delete a row from the table, the caller need to build the where clause.

func (*Table) Insert

func (t *Table) Insert(ctx context.Context, columns []string, values ...any) error

Insert insert a row into the table.

func (*Table) Query

func (t *Table) Query(ctx context.Context, columns []string, where string) ([][]string, error)

Query query the table with given where clause, and returns the result.

Jump to

Keyboard shortcuts

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