Documentation
¶
Index ¶
- func OpenDB(comfy *ComfyDB, opts ...OpenDBOption) *sql.DB
- func WithForeignKeys() func(*OpenDBOptions)
- func WithOption(options string) func(*OpenDBOptions)
- type Column
- type ComfyDB
- func (c *ComfyDB) Begin() (*sql.Tx, error)
- func (c *ComfyDB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
- func (c *ComfyDB) Close() error
- func (c *ComfyDB) Conn(ctx context.Context) (*sql.Conn, error)
- func (c *ComfyDB) Down(ctx context.Context, amount int) error
- func (c *ComfyDB) Driver() driver.Driver
- func (c *ComfyDB) Exec(query string, args ...interface{}) (sql.Result, error)
- func (c *ComfyDB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (c *ComfyDB) Index() ([]uint, error)
- func (c *ComfyDB) Migrations() ([]Migration, error)
- func (c *ComfyDB) New(fn SqlFn) uint64
- func (c *ComfyDB) Ping() error
- func (c *ComfyDB) PingContext(ctx context.Context) error
- func (c *ComfyDB) Prepare(query string) (*sql.Stmt, error)
- func (c *ComfyDB) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
- func (c *ComfyDB) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (c *ComfyDB) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (c *ComfyDB) QueryRow(query string, args ...interface{}) *sql.Row
- func (c *ComfyDB) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (c *ComfyDB) Run(ctx context.Context, item *workItem) error
- func (c *ComfyDB) RunSQL(fn SqlFn) (interface{}, error)
- func (c *ComfyDB) SetConnMaxIdleTime(d time.Duration)
- func (c *ComfyDB) SetConnMaxLifetime(d time.Duration)
- func (c *ComfyDB) SetMaxIdleConns(n int)
- func (c *ComfyDB) SetMaxOpenConns(n int)
- func (c *ComfyDB) ShowColumns(table string) ([]Column, error)
- func (c *ComfyDB) ShowTables() ([]string, error)
- func (c *ComfyDB) Stats() sql.DBStats
- func (c *ComfyDB) Up(ctx context.Context) error
- func (c *ComfyDB) Version() (uint, error)
- func (c *ComfyDB) WaitFor(workID uint64) (interface{}, error)
- func (c *ComfyDB) WaitForChn(workID uint64) <-chan interface{}
- type ComfyDriver
- type ComfyOption
- func WithConnection(conn string) ComfyOption
- func WithDriver(driver string) ComfyOption
- func WithMemory() ComfyOption
- func WithMigration(migrations ...Migration) ComfyOption
- func WithMigrationTableName(name string) ComfyOption
- func WithPanicHandler(handler onPanic) ComfyOption
- func WithPath(path string) ComfyOption
- func WithRetryAttempts(attempts int) ComfyOption
- func WithRetryDelay(delay time.Duration) ComfyOption
- type Migration
- type OpenDBOption
- type OpenDBOptions
- type SqlFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenDB ¶
func OpenDB(comfy *ComfyDB, opts ...OpenDBOption) *sql.DB
OpenDB creates a new sql.DB instance using ComfyDB
func WithForeignKeys ¶
func WithForeignKeys() func(*OpenDBOptions)
func WithOption ¶
func WithOption(options string) func(*OpenDBOptions)
Types ¶
type ComfyDB ¶
type ComfyDB struct {
// contains filtered or unexported fields
}
ComfyDB is a wrapper around sqlite3 that provides a simple API for executing SQL queries with goroutines.
func New ¶
func New(opts ...ComfyOption) (*ComfyDB, error)
Create a new ComfyLite3 wrapper around sqlite3. Instantiate a scheduler to process your queries.
func (*ComfyDB) ExecContext ¶
func (*ComfyDB) Migrations ¶
Get all migrations.
func (*ComfyDB) PrepareContext ¶
func (*ComfyDB) QueryContext ¶
func (*ComfyDB) QueryRowContext ¶
func (*ComfyDB) SetConnMaxIdleTime ¶
func (*ComfyDB) SetConnMaxLifetime ¶
func (*ComfyDB) SetMaxIdleConns ¶
func (*ComfyDB) SetMaxOpenConns ¶
func (*ComfyDB) ShowColumns ¶
Show all columns in a table.
func (*ComfyDB) ShowTables ¶
Show all tables in the database. Returns a slice of the names of the tables.
func (*ComfyDB) WaitForChn ¶
WaitForChn waits for the result of a workID (your query) and returns a channel.
type ComfyDriver ¶
type ComfyDriver struct {
// contains filtered or unexported fields
}
func (*ComfyDriver) Driver ¶
func (cd *ComfyDriver) Driver() driver.Driver
type ComfyOption ¶
type ComfyOption func(*ComfyDB)
func WithConnection ¶
func WithConnection(conn string) ComfyOption
WithConnection sets a custom connection string for the database.
func WithDriver ¶
func WithDriver(driver string) ComfyOption
func WithMigration ¶
func WithMigration(migrations ...Migration) ComfyOption
Records your migrations for your database.
func WithMigrationTableName ¶
func WithMigrationTableName(name string) ComfyOption
WithMigrationTableName sets the name of the migration table.
func WithPanicHandler ¶
func WithPanicHandler(handler onPanic) ComfyOption
WithPanicHandler sets custom panic handler
func WithRetryAttempts ¶
func WithRetryAttempts(attempts int) ComfyOption
WithRetryAttempts sets maximum retry attempts for failed operations
func WithRetryDelay ¶
func WithRetryDelay(delay time.Duration) ComfyOption
WithRetryDelay sets delay between retries
type Migration ¶
type OpenDBOption ¶
type OpenDBOption func(*OpenDBOptions)
type OpenDBOptions ¶
type OpenDBOptions struct {
// contains filtered or unexported fields
}