Documentation ¶
Index ¶
- Constants
- type BaseDB
- type Session
- func (own *Session) Begin() (err error)
- func (own *Session) CallMethod(method string, value any)
- func (own *Session) Clear()
- func (own *Session) Commit() (err error)
- func (own *Session) Count() (int64, error)
- func (own *Session) CreateTable() error
- func (own *Session) Delete() (int64, error)
- func (own *Session) DropTable() error
- func (own *Session) Exec(query string, args ...any) (result sql.Result, err error)
- func (own *Session) GetDB() BaseDB
- func (own *Session) GetSchema() *schema.Schema
- func (own *Session) GroupBy(fields ...any) *Session
- func (own *Session) Insert(values ...any) (int64, error)
- func (own *Session) IsExistTable() bool
- func (own *Session) Limit(limits ...any) *Session
- func (own *Session) OrderBy(orders ...any) *Session
- func (own *Session) Query(query string, args ...any) (rows *sql.Rows, err error)
- func (own *Session) QueryRow(query string, args ...any) *sql.Row
- func (own *Session) Rollback() (err error)
- func (own *Session) Select(values any) error
- func (own *Session) SelectFirst(value any) error
- func (own *Session) SetModel(model any) *Session
- func (own *Session) Update(values ...any) (int64, error)
- func (own *Session) Where(conditions ...any) *Session
Constants ¶
View Source
const ( HOOK_AFTER_SELECT = "CallAfterSelect" HOOK_AFTER_UPDATE = "CallAfterUpdate" HOOK_AFTER_DELETE = "CallAfterDelete" HOOK_AFTER_INSERT = "CallAfterInsert" HOOK_BEFORE_SELECT = "CallBeforeSelect" HOOK_BEFORE_UPDATE = "CallBeforeUpdate" HOOK_BEFORE_DELETE = "CallBeforeDelete" HOOK_BEFORE_INSERT = "CallBeforeInsert" )
Hooks constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseDB ¶
type BaseDB interface { Exec(query string, args ...any) (sql.Result, error) Query(query string, args ...any) (*sql.Rows, error) QueryRow(query string, args ...any) *sql.Row }
BaseDB is a minimal function set of db.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session keep a pointer to sql.DB and provides all execution of all kind of database operations.
func (*Session) CallMethod ¶
CallMethod calls the registered hooks
func (*Session) CreateTable ¶
CreateTable creates a table in database with a data model
func (*Session) IsExistTable ¶
IsExistTable returns true of the table exists
func (*Session) SelectFirst ¶
SelectFirst selects the 1st record
Click to show internal directories.
Click to hide internal directories.