db

package
v0.0.0-...-bd67ee7 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConnectionFactoryMap = map[string]DbHandleFactory{
	"sqlite3": &SqliteHandler{},
}

Functions

func Close

func Close(db DbHandle)

func FindCompanyById

func FindCompanyById(handle DbHandle, companyId int) (*model.Company, error)

func FindCompanyByName

func FindCompanyByName(handle DbHandle, companyName string) ([]model.Company, error)

func FindContextEligibleTrackerTypes

func FindContextEligibleTrackerTypes(handle DbHandle) ([]model.TrackerType, error)

func FindTitleById

func FindTitleById(handle DbHandle, titleId int) (*model.Title, error)

func FindTitleByName

func FindTitleByName(handle DbHandle, title string, companyId int) ([]model.Title, error)

func FindTrackerTypes

func FindTrackerTypes(handle DbHandle) ([]model.TrackerType, error)

func InitializeDb

func InitializeDb(handle DbHandle)

func InsertActivityEvent

func InsertActivityEvent(handle DbHandle, action model.Action, trackerTypeId int, title string) (int, error)

func NamedQuery

func NamedQuery[T any](
	handle DbHandle,
	dot *dotsql.DotSql,
	binder func(*T) []any,
	query string,
	args ...any) (error, []T)

func SeedDb

func SeedDb(handle DbHandle)

Types

type DbHandle

type DbHandle interface {
	Db() *sql.DB
	Version() string
	Create()
}

func Run

func Run(config config.Config) DbHandle

type DbHandleFactory

type DbHandleFactory interface {
	Connect(config.Config) DbHandle
}

type SqliteDbHandle

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

Extension of DbHandler struct

func (SqliteDbHandle) Create

func (f SqliteDbHandle) Create()

func (SqliteDbHandle) Db

func (f SqliteDbHandle) Db() *sql.DB

func (SqliteDbHandle) DbPath

func (f SqliteDbHandle) DbPath() string

func (SqliteDbHandle) Version

func (f SqliteDbHandle) Version() string

type SqliteHandler

type SqliteHandler struct{}

func (SqliteHandler) Connect

func (f SqliteHandler) Connect(config config.Config) DbHandle

Jump to

Keyboard shortcuts

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