Documentation
¶
Index ¶
- Variables
- type Session
- func (s *Session) Begin() error
- func (s *Session) Close() error
- func (s *Session) Commit() error
- func (s *Session) Context() context.Context
- func (s *Session) Delete(tbl interface{}) *query.DeleteBuilder
- func (s *Session) Engine() *engine.Engine
- func (s *Session) Exec(query string, args ...interface{}) (sql.Result, error)
- func (s *Session) GetTableColumns(tbl interface{}) []*table.ColumnRef
- func (s *Session) GetTableName(tbl interface{}) string
- func (s *Session) InTransaction() bool
- func (s *Session) Insert(tbl interface{}) *query.InsertBuilder
- func (s *Session) Query(tbl interface{}) *query.SelectBuilder
- func (s *Session) QueryRow(query string, args ...interface{}) *sql.Row
- func (s *Session) QueryRows(query string, args ...interface{}) (*sql.Rows, error)
- func (s *Session) Rollback() error
- func (s *Session) Update(tbl interface{}) *query.UpdateBuilder
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotInTransaction is returned when attempting transaction operations outside a transaction ErrNotInTransaction = errors.New("session is not in a transaction") // ErrAlreadyInTransaction is returned when attempting to start a transaction while already in one ErrAlreadyInTransaction = errors.New("session is already in a transaction") )
Functions ¶
This section is empty.
Types ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session represents a database session for executing queries
func NewSession ¶ added in v2.0.1
NewSession creates a new session bound to the engine
func (*Session) Delete ¶
func (s *Session) Delete(tbl interface{}) *query.DeleteBuilder
Delete creates a new DELETE query builder
func (*Session) GetTableColumns ¶
GetTableColumns extracts column references from a Table[T] object
func (*Session) GetTableName ¶
GetTableName extracts the table name from a Table[T] object
func (*Session) InTransaction ¶
InTransaction returns true if the session is in a transaction
func (*Session) Insert ¶
func (s *Session) Insert(tbl interface{}) *query.InsertBuilder
Insert creates a new INSERT query builder
func (*Session) Query ¶
func (s *Session) Query(tbl interface{}) *query.SelectBuilder
Query creates a new SELECT query builder
func (*Session) Rollback ¶
Rollback rolls back the transaction (only valid if session is in a transaction)
func (*Session) Update ¶
func (s *Session) Update(tbl interface{}) *query.UpdateBuilder
Update creates a new UPDATE query builder
Click to show internal directories.
Click to hide internal directories.