Documentation
¶
Index ¶
- Variables
- type BaseEngine
- func (b *BaseEngine[E, K]) ConflictColumns() []string
- func (b *BaseEngine[E, K]) Count() (int, error)
- func (b *BaseEngine[E, K]) Delete(key K) error
- func (b *BaseEngine[E, K]) DeleteAll() error
- func (b *BaseEngine[E, K]) Find(key K) (*E, error)
- func (b *BaseEngine[E, K]) FromRow(*sql.Rows) (E, error)
- func (b *BaseEngine[E, K]) IntPrimaryKey() *string
- func (b *BaseEngine[E, K]) IsEmptyFast() (bool, error)
- func (b *BaseEngine[E, K]) KeyArgs(K) []any
- func (b *BaseEngine[E, K]) KeyColumns() []string
- func (b *BaseEngine[E, K]) Load(mode PaginationMode, limit int, offset int, lastID *int) ([]E, error)
- func (b *BaseEngine[E, K]) Save(entity E, mode InserType) error
- func (b *BaseEngine[E, K]) SaveBatch(entities []E, mode InserType) error
- func (b *BaseEngine[E, K]) Table() string
- func (b *BaseEngine[E, K]) Upsert(entity E, updateColumns []string) error
- func (b *BaseEngine[E, K]) UpsertBatch(entities []E, updateColumns []string) error
- type Config
- type DBMaintenanceScheduler
- type DatabaseEngine
- type Dialect
- type Driver
- type EngineSpec
- type InserType
- type PaginationMode
- type PostgresDialect
- func (PostgresDialect) DriverName() string
- func (PostgresDialect) Init(*sql.DB) error
- func (d PostgresDialect) Insert(table string, cols []string) string
- func (d PostgresDialect) InsertIgnore(table string, cols []string, conflictCols []string) string
- func (d PostgresDialect) InsertReplace(table string, cols []string, conflictCols []string) string
- func (PostgresDialect) Placeholder(index int) string
- func (d PostgresDialect) Placeholders(count int, startIndex int) string
- func (PostgresDialect) QuoteIdent(name string) string
- func (PostgresDialect) SupportsMaintenance() bool
- func (d PostgresDialect) Upsert(table string, cols []string, conflictCols []string, updateCols []string) string
- type SQLiteDialect
- func (SQLiteDialect) DriverName() string
- func (SQLiteDialect) Init(db *sql.DB) error
- func (d SQLiteDialect) Insert(table string, cols []string) string
- func (d SQLiteDialect) InsertIgnore(table string, cols []string, _ []string) string
- func (d SQLiteDialect) InsertReplace(table string, cols []string, _ []string) string
- func (SQLiteDialect) Placeholder(int) string
- func (d SQLiteDialect) Placeholders(count int, startIndex int) string
- func (SQLiteDialect) QuoteIdent(name string) string
- func (SQLiteDialect) SupportsMaintenance() bool
- func (d SQLiteDialect) Upsert(table string, cols []string, conflictCols []string, updateCols []string) string
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type BaseEngine ¶
func NewBaseEngine ¶
func NewBaseEngine[E any, K any]( e *DatabaseEngine, spec EngineSpec[E, K], ) *BaseEngine[E, K]
func (*BaseEngine[E, K]) ConflictColumns ¶
func (b *BaseEngine[E, K]) ConflictColumns() []string
func (*BaseEngine[E, K]) Count ¶
func (b *BaseEngine[E, K]) Count() (int, error)
func (*BaseEngine[E, K]) Delete ¶
func (b *BaseEngine[E, K]) Delete(key K) error
func (*BaseEngine[E, K]) DeleteAll ¶
func (b *BaseEngine[E, K]) DeleteAll() error
func (*BaseEngine[E, K]) Find ¶
func (b *BaseEngine[E, K]) Find(key K) (*E, error)
func (*BaseEngine[E, K]) IntPrimaryKey ¶
func (b *BaseEngine[E, K]) IntPrimaryKey() *string
func (*BaseEngine[E, K]) IsEmptyFast ¶
func (b *BaseEngine[E, K]) IsEmptyFast() (bool, error)
func (*BaseEngine[E, K]) KeyArgs ¶
func (b *BaseEngine[E, K]) KeyArgs(K) []any
func (*BaseEngine[E, K]) KeyColumns ¶
func (b *BaseEngine[E, K]) KeyColumns() []string
func (*BaseEngine[E, K]) Load ¶
func (b *BaseEngine[E, K]) Load( mode PaginationMode, limit int, offset int, lastID *int, ) ([]E, error)
func (*BaseEngine[E, K]) Save ¶
func (b *BaseEngine[E, K]) Save(entity E, mode InserType) error
func (*BaseEngine[E, K]) SaveBatch ¶
func (b *BaseEngine[E, K]) SaveBatch( entities []E, mode InserType, ) error
func (*BaseEngine[E, K]) Table ¶
func (b *BaseEngine[E, K]) Table() string
⚠️ DI-OVERRIDE OLEH ENGINE SPESIFIK
func (*BaseEngine[E, K]) Upsert ¶
func (b *BaseEngine[E, K]) Upsert( entity E, updateColumns []string, ) error
func (*BaseEngine[E, K]) UpsertBatch ¶
func (b *BaseEngine[E, K]) UpsertBatch( entities []E, updateColumns []string, ) error
type DBMaintenanceScheduler ¶
type DBMaintenanceScheduler struct {
// contains filtered or unexported fields
}
func NewDBMaintenanceScheduler ¶
func NewDBMaintenanceScheduler(e *DatabaseEngine) *DBMaintenanceScheduler
func (*DBMaintenanceScheduler) Start ¶
func (s *DBMaintenanceScheduler) Start()
func (*DBMaintenanceScheduler) Stop ¶
func (s *DBMaintenanceScheduler) Stop()
type DatabaseEngine ¶
type DatabaseEngine struct {
// contains filtered or unexported fields
}
func Open ¶
func Open(config Config) (*DatabaseEngine, error)
func Start ¶
func Start(fileName string, sqlFiles []string, table []string) (*DatabaseEngine, error)
func StartAtPath ¶
func StartAtPath(path string, sqlFiles []string, table []string) (*DatabaseEngine, error)
func (*DatabaseEngine) Close ¶
func (e *DatabaseEngine) Close() error
func (*DatabaseEngine) DB ¶
func (e *DatabaseEngine) DB() *sql.DB
func (*DatabaseEngine) Driver ¶
func (e *DatabaseEngine) Driver() Driver
type Dialect ¶
type Dialect interface {
DriverName() string
Placeholder(index int) string
Placeholders(count int, startIndex int) string
QuoteIdent(name string) string
Insert(table string, cols []string) string
InsertIgnore(table string, cols []string, conflictCols []string) string
InsertReplace(table string, cols []string, conflictCols []string) string
Upsert(table string, cols []string, conflictCols []string, updateCols []string) string
Init(db *sql.DB) error
SupportsMaintenance() bool
}
type EngineSpec ¶
type PaginationMode ¶
type PaginationMode int
const ( PaginationOffset PaginationMode = iota PaginationKeyset )
type PostgresDialect ¶
type PostgresDialect struct{}
func (PostgresDialect) DriverName ¶
func (PostgresDialect) DriverName() string
func (PostgresDialect) InsertIgnore ¶
func (d PostgresDialect) InsertIgnore(table string, cols []string, conflictCols []string) string
func (PostgresDialect) InsertReplace ¶
func (d PostgresDialect) InsertReplace(table string, cols []string, conflictCols []string) string
func (PostgresDialect) Placeholder ¶
func (PostgresDialect) Placeholder(index int) string
func (PostgresDialect) Placeholders ¶
func (d PostgresDialect) Placeholders(count int, startIndex int) string
func (PostgresDialect) QuoteIdent ¶
func (PostgresDialect) QuoteIdent(name string) string
func (PostgresDialect) SupportsMaintenance ¶
func (PostgresDialect) SupportsMaintenance() bool
type SQLiteDialect ¶
type SQLiteDialect struct{}
func (SQLiteDialect) DriverName ¶
func (SQLiteDialect) DriverName() string
func (SQLiteDialect) InsertIgnore ¶
func (d SQLiteDialect) InsertIgnore(table string, cols []string, _ []string) string
func (SQLiteDialect) InsertReplace ¶
func (d SQLiteDialect) InsertReplace(table string, cols []string, _ []string) string
func (SQLiteDialect) Placeholder ¶
func (SQLiteDialect) Placeholder(int) string
func (SQLiteDialect) Placeholders ¶
func (d SQLiteDialect) Placeholders(count int, startIndex int) string
func (SQLiteDialect) QuoteIdent ¶
func (SQLiteDialect) QuoteIdent(name string) string
func (SQLiteDialect) SupportsMaintenance ¶
func (SQLiteDialect) SupportsMaintenance() bool
Source Files
¶
Click to show internal directories.
Click to hide internal directories.