sqlitedatabase

package
v0.0.0-...-be14f60 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DBOnce sync.Once

DBOnce used to execute client creation procedure only once. nolint:gochecknoglobals

Functions

This section is empty.

Types

type DB

type DB struct {
	Client *sql.DB
}

DB is database type that implement database interface.

func NewDB

func NewDB() (*DB, error)

NewDB create new DB struct.

func (*DB) AddNewCard

func (db *DB) AddNewCard(card models.Card) error

AddNewCard get card and add it to database.

func (*DB) CreateCardTable

func (db *DB) CreateCardTable() error

CreateCardTable check if card table exist or not and if not creates one.

func (*DB) DeleteCard

func (db *DB) DeleteCard(id string) error

DeleteCard get card id and remove it from database.

func (*DB) FindByID

func (db *DB) FindByID(id string) (*models.Card, error)

FindByID get card d and find it in the database and return it.

func (*DB) GetCards

func (db *DB) GetCards() ([]models.Card, error)

GetCards query all cards from database and return them.

func (*DB) UpdateCard

func (db *DB) UpdateCard(card models.Card) error

UpdateCard get card and update it in database.

Jump to

Keyboard shortcuts

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