Documentation
¶
Index ¶
- func Close() error
- func Connect(config Config) error
- func DB() *sql.DB
- func IsConnected() bool
- type Config
- type Model
- func (m *Model) Create(data interface{}) error
- func (m *Model) Delete(id interface{}) error
- func (m *Model) Find(id interface{}, dest interface{}) error
- func (m *Model) FindAll(dest interface{}) error
- func (m *Model) Table(name string) *Model
- func (m *Model) Update(id interface{}, data interface{}) error
- func (m *Model) Where(condition string, args ...interface{}) *QueryBuilder
- type QueryBuilder
- func (qb *QueryBuilder) All(dest interface{}) error
- func (qb *QueryBuilder) First(dest interface{}) error
- func (qb *QueryBuilder) Limit(limit int) *QueryBuilder
- func (qb *QueryBuilder) Offset(offset int) *QueryBuilder
- func (qb *QueryBuilder) Order(orderBy string) *QueryBuilder
- func (qb *QueryBuilder) Where(condition string, args ...interface{}) *QueryBuilder
- type Timestamps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Adapter string
Database string
Host string
Port string
Username string
Password string
SSLMode string
}
Config holds database configuration
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the base model that provides common functionality
func (*Model) Where ¶
func (m *Model) Where(condition string, args ...interface{}) *QueryBuilder
Where adds a WHERE clause
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
QueryBuilder builds database queries
func (*QueryBuilder) All ¶
func (qb *QueryBuilder) All(dest interface{}) error
All finds all matching records
func (*QueryBuilder) First ¶
func (qb *QueryBuilder) First(dest interface{}) error
First finds the first matching record
func (*QueryBuilder) Limit ¶
func (qb *QueryBuilder) Limit(limit int) *QueryBuilder
Limit sets the LIMIT
func (*QueryBuilder) Offset ¶
func (qb *QueryBuilder) Offset(offset int) *QueryBuilder
Offset sets the OFFSET
func (*QueryBuilder) Order ¶
func (qb *QueryBuilder) Order(orderBy string) *QueryBuilder
Order adds ORDER BY clause
func (*QueryBuilder) Where ¶
func (qb *QueryBuilder) Where(condition string, args ...interface{}) *QueryBuilder
Where adds another WHERE clause
Click to show internal directories.
Click to hide internal directories.