Documentation
¶
Index ¶
- func SqliteSeed(ts *testing.T, name string, fn func(*testing.T, SqlDataStore))
- type Cache
- type DataStore
- type Option
- type SqlDataStore
- type SqliteStore
- func (store *SqliteStore) Begin() (SqlDataStore, error)
- func (store *SqliteStore) BulkInsert(table string, columns []string, rows [][]any) error
- func (store *SqliteStore) Commit() error
- func (store *SqliteStore) Connect() error
- func (store *SqliteStore) CreateDatabase(schema ...string) error
- func (store *SqliteStore) Exec(query string, args ...any) error
- func (store *SqliteStore) ExecAndReturnID(query string, args ...any) (string, error)
- func (store *SqliteStore) ExecAndReturnRowsAffected(query string, args ...any) (int64, error)
- func (store *SqliteStore) Get(query string, found any, args ...any) error
- func (store *SqliteStore) Ping() error
- func (store *SqliteStore) Query(query string, found any, args ...any) error
- func (store *SqliteStore) QueryAll(query string, found any, args ...any) error
- func (store *SqliteStore) QueryOne(query string, found any, args ...any) error
- func (store *SqliteStore) Rollback() error
- func (store *SqliteStore) RunSql(sql string) error
- func (store *SqliteStore) WithContext(ctx context.Context) SqlDataStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SqliteSeed ¶
Types ¶
type Cache ¶
type Cache interface {
Set(key string, value any, ttl time.Duration)
Get(key string) (any, bool)
Delete(key string)
}
func NewMemoryCache ¶
func NewMemoryCache() Cache
type DataStore ¶
type DataStore interface {
Sqlite() SqlDataStore
MemoryCache() Cache
}
type SqlDataStore ¶
type SqlDataStore interface {
WithContext(ctx context.Context) SqlDataStore
Ping() error
RunSql(schema string) error
CreateDatabase(schema ...string) error
Get(query string, found any, args ...any) error
Query(query string, found any, args ...any) error
QueryOne(query string, found any, args ...any) error
QueryAll(query string, found any, args ...any) error
Exec(query string, args ...any) error
ExecAndReturnID(query string, args ...any) (string, error)
ExecAndReturnRowsAffected(query string, args ...any) (int64, error)
BulkInsert(table string, columns []string, rows [][]any) error
Begin() (SqlDataStore, error)
Commit() error
Rollback() error
Connect() error
}
func NewSqlite ¶
func NewSqlite(address string) SqlDataStore
type SqliteStore ¶
type SqliteStore struct {
// contains filtered or unexported fields
}
func (*SqliteStore) Begin ¶
func (store *SqliteStore) Begin() (SqlDataStore, error)
func (*SqliteStore) BulkInsert ¶
func (store *SqliteStore) BulkInsert(table string, columns []string, rows [][]any) error
func (*SqliteStore) Commit ¶
func (store *SqliteStore) Commit() error
func (*SqliteStore) Connect ¶
func (store *SqliteStore) Connect() error
func (*SqliteStore) CreateDatabase ¶
func (store *SqliteStore) CreateDatabase(schema ...string) error
func (*SqliteStore) ExecAndReturnID ¶
func (store *SqliteStore) ExecAndReturnID(query string, args ...any) (string, error)
func (*SqliteStore) ExecAndReturnRowsAffected ¶
func (store *SqliteStore) ExecAndReturnRowsAffected(query string, args ...any) (int64, error)
func (*SqliteStore) Ping ¶
func (store *SqliteStore) Ping() error
func (*SqliteStore) Query ¶
func (store *SqliteStore) Query(query string, found any, args ...any) error
func (*SqliteStore) QueryAll ¶
func (store *SqliteStore) QueryAll(query string, found any, args ...any) error
func (*SqliteStore) QueryOne ¶
func (store *SqliteStore) QueryOne(query string, found any, args ...any) error
func (*SqliteStore) Rollback ¶
func (store *SqliteStore) Rollback() error
func (*SqliteStore) RunSql ¶
func (store *SqliteStore) RunSql(sql string) error
func (*SqliteStore) WithContext ¶
func (store *SqliteStore) WithContext(ctx context.Context) SqlDataStore
Click to show internal directories.
Click to hide internal directories.