session

package
v0.0.0-...-d6a6539 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session struct holds the database connection and the SQL query to be executed.

func New

func New(db *sql.DB, dialect dialect.Dialect) *Session

New creates a new Session with the provided database connection.

func (*Session) Clear

func (s *Session) Clear()

Clear resets the SQL query and its arguments in the Session.

func (*Session) CreateTable

func (s *Session) CreateTable() error

func (*Session) DB

func (s *Session) DB() *sql.DB

DB returns the database connection from the Session.

func (*Session) DropTable

func (s *Session) DropTable() error

func (*Session) Exec

func (s *Session) Exec() (result sql.Result, err error)

Exec executes the SQL query in the Session and returns the result.

func (*Session) ExecContext

func (s *Session) ExecContext(ctx context.Context) (result sql.Result, err error)

ExecContext executes the SQL query in the Session with a context and returns the result.

func (*Session) HasTable

func (s *Session) HasTable() bool

func (*Session) Model

func (s *Session) Model(value interface{}) *Session

func (*Session) Query

func (s *Session) Query() (result *sql.Rows, err error)

Query executes the SQL query in the Session and returns the rows.

func (*Session) QueryContext

func (s *Session) QueryContext(ctx context.Context) (result *sql.Rows, err error)

QueryContext executes the SQL query in the Session with a context and returns the rows.

func (*Session) QueryRow

func (s *Session) QueryRow() *sql.Row

QueryRow executes the SQL query in the Session and returns the first row.

func (*Session) QueryRowContext

func (s *Session) QueryRowContext(ctx context.Context) *sql.Row

QueryRowContext executes the SQL query in the Session with a context and returns the first row.

func (*Session) Raw

func (s *Session) Raw(sql string, args ...interface{}) *Session

Raw sets the SQL query and its arguments in the Session.

func (*Session) RefTable

func (s *Session) RefTable() *schema.Schema

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL