Documentation ¶
Overview ¶
Package data provides a set of data types for the database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Schema is the schema for the libsql database Schema string // URI is the uri for the libsql database URI string // Name is the name for the libsql database Name string // FileName is the file name for the sqlite database FileName string }
Config is a struct that holds the configuration for a database.
type ConfigFile ¶
type ConfigFile struct { URLs struct { URL string `json:"url" yaml:"url"` } `json:"urls" yaml:"urls"` }
ConfigFile is a struct for a config file.
type Database ¶
Database is a struct that holds the sql database and the queries. It uses generics to hold the appropriate type of query struct.
func NewDb ¶
func NewDb[ Q master.Queries, ]( ctx context.Context, newFunc func(generic.DBTX) *Q, config *Config, ) (*Database[Q], error)
NewDb sets up the database using the URI and optional options. Using generics to return the appropriate type of query struct, it creates a new database struct with the sql database and the queries struct utilizing the URI and optional options provided.
func NewSQLDatabase ¶
func NewSQLDatabase[ Q master.Queries, ]( parentCtx context.Context, db *sql.DB, newFunc func(generic.DBTX) *Q, ) (*Database[Q], error)
NewSQLDatabase creates a new database struct with the sql database and the queries struct. It uses generics to return the appropriate type of query
Directories ¶
Path | Synopsis |
---|---|
Package generic provides a generic interface for a database.
|
Package generic provides a generic interface for a database. |
Package logs contains the sqlite database schema
|
Package logs contains the sqlite database schema |
Package master contains the sqlite database schema
|
Package master contains the sqlite database schema |