Documentation
¶
Index ¶
- Constants
- Variables
- func Entities[T tables.Table](db *DB, table *[]T, query string) error
- func IsPragmaEmpty(rows pragma) bool
- func SingleEntity[T tables.Table](db *DB, table *T, query string) error
- type DB
- func (db *DB) ApplyMigrations(migrations []string, altered bool) error
- func (db *DB) ApplyMigrationsNow(migrations []string, altered bool) error
- func (db *DB) Exec(query string, args ...any) error
- func (db *DB) Fields(query string, table tables.Table, fields ...string) (fields, error)
- func (db *DB) GenMigrations() error
- func (db *DB) Handle() *sqlx.DB
- func (db *DB) InsertEntity(table tables.Table) error
- func (db *DB) PragmaOf(table tables.Table) (pragma, error)
- func (db *DB) Select(dest interface{}, query string) error
Constants ¶
View Source
const COUNTDOWN = 5
View Source
const INSTANT_ENV = "ORM_INSTANT"
View Source
const MIGRATE_ENV = "ORM_MIGRATE"
Variables ¶
View Source
var EmptyErr = errors.New("Result is empty")
Functions ¶
func IsPragmaEmpty ¶
func IsPragmaEmpty(rows pragma) bool
Types ¶
type DB ¶
type DB struct { // The slice of registered tables. // // Modify it DIRECTLY, because why build useless interfaces. Tables []tables.Table // contains filtered or unexported fields }
Database handle wrapper.
func NewDB ¶
Create a new DB object using the handle.
Note: Don't forget to add your table.Table-s into DB.Tables after creation!
In order to use the migration functionality, call DB.GenMigrations()
func (*DB) ApplyMigrationsNow ¶
func (*DB) GenMigrations ¶
Click to show internal directories.
Click to hide internal directories.