db

package
v0.0.0-...-e95300f Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2019 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	*sql.DB
}

Database is a SQLite3 implementation of the primitives.Database interface.

func New

func New(path string) (*Database, error)

New creates a new database with the pathname passed.

func (*Database) Create

func (db *Database) Create(r primitives.Record) error

Create inserts a new record in the database.

func (*Database) Delete

func (db *Database) Delete(r primitives.Record) error

Delete removes an existing database record.

func (*Database) FindBy

func (db *Database) FindBy(field string, value interface{}, r primitives.Record) error

FindBy tries to find a record with the column match the value passed. Example: FindBy("id", 1, &primtives.Bear{})

func (*Database) Register

func (db *Database) Register(rs ...primitives.Record) error

Register creates a table for each record passed in.

func (*Database) Update

func (db *Database) Update(r primitives.Record) error

Update saves an existing database record.

Jump to

Keyboard shortcuts

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