store

package
v0.0.0-...-748338d Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2024 License: MIT Imports: 9 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 {
	Connection  *sqlx.DB
	QueryBuffer chan QueryExecutor
}

func NewDBConnection

func NewDBConnection(config DBConnectionConfig) (*DB, error)

func NewDefaultDBConnection

func NewDefaultDBConnection() (*DB, error)

func (*DB) GetAllOffices

func (db *DB) GetAllOffices() ([]types.Office, error)

func (*DB) GetAllProducts

func (db *DB) GetAllProducts() ([]types.Product, error)

func (*DB) GetRandomOffice

func (db *DB) GetRandomOffice() (types.Office, error)

func (*DB) GetRandomProduct

func (db *DB) GetRandomProduct() (types.Product, error)

func (*DB) InsertOffice

func (db *DB) InsertOffice(office types.Office) error

func (*DB) InsertProduct

func (db *DB) InsertProduct(product types.Product) error

func (*DB) InsertTicket

func (db *DB) InsertTicket(ticket types.Ticket) (int, error)

type DBConnectionConfig

type DBConnectionConfig struct {
	DatabaseDriver  string
	DatabaseName    string
	Host            string
	Password        string
	Port            string
	QueryBufferSize uint8
	User            string
}

func NewDBConnectionConfig

func NewDBConnectionConfig() DBConnectionConfig

func (DBConnectionConfig) WithDatabaseDriver

func (config DBConnectionConfig) WithDatabaseDriver(driver string) DBConnectionConfig

func (DBConnectionConfig) WithDatabaseName

func (config DBConnectionConfig) WithDatabaseName(name string) DBConnectionConfig

func (DBConnectionConfig) WithHost

func (config DBConnectionConfig) WithHost(host string) DBConnectionConfig

func (DBConnectionConfig) WithPassword

func (config DBConnectionConfig) WithPassword(password string) DBConnectionConfig

func (DBConnectionConfig) WithPort

func (config DBConnectionConfig) WithPort(port string) DBConnectionConfig

func (DBConnectionConfig) WithQueryBufferSize

func (config DBConnectionConfig) WithQueryBufferSize(size uint8) DBConnectionConfig

func (DBConnectionConfig) WithUser

func (config DBConnectionConfig) WithUser(user string) DBConnectionConfig

type QueryExecutor

type QueryExecutor interface {
	GetQuery() []string
	Execute(*sqlx.DB)
}

Jump to

Keyboard shortcuts

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