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 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, dialect schema.Dialect, 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