Documentation ¶
Index ¶
- type Column
- type ComfyDB
- func (c *ComfyDB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
- func (c *ComfyDB) Being() (*sql.Tx, error)
- func (c *ComfyDB) Clear(id uint64)
- func (c *ComfyDB) Close()
- 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) IsDone(workID uint64) bool
- 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) 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) <-chan interface{}
- type ComfyOption
- type Migration
- type RingBuffer
- type SqlFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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. It also provides a simple API for managing migrations. Goodbye frustrations with sqlite3 and goroutines.
func Comfy ¶
func Comfy(opts ...ComfyOption) (*ComfyDB, error)
Create a new ComfyLite3 wrapper around sqlite3. Instanciate 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.
type ComfyOption ¶
type ComfyOption func(*ComfyDB)
func WithBuffer ¶
func WithBuffer(size int64) ComfyOption
WithBuffer sets the size of the ring buffer which is used by the scheduler to process your queries. (default=1024) If the buffer is full, it will create a second one of that size value automatically.
func WithConnection ¶
func WithConnection(conn string) ComfyOption
WithConnection sets a custom connection string for the database.
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.
type Migration ¶
type RingBuffer ¶
type RingBuffer[T any] struct { // contains filtered or unexported fields }
func Buffer ¶
func Buffer[T any](size int64) *RingBuffer[T]
func (*RingBuffer[T]) Len ¶
func (rb *RingBuffer[T]) Len() int64
func (*RingBuffer[T]) Pop ¶
func (rb *RingBuffer[T]) Pop() (T, bool)
func (*RingBuffer[T]) PopN ¶
func (rb *RingBuffer[T]) PopN(n int64) ([]T, bool)
func (*RingBuffer[T]) Push ¶
func (rb *RingBuffer[T]) Push(item T)