joins2

package
v0.0.0-...-06e4aab Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WrapErr     = func(err *Error) error { return err }
	Logger      func(format string, args ...any)
	ShouldRetry func(driver string, err error) bool
)
View Source
var SQLite3JournalMode = "WAL"

SQLite3JournalMode controls the journal_mode pragma for all new connections. Since it is read without a mutex, it must be changed to the value you want before any Open calls.

Functions

func DeleteAll

func DeleteAll(ctx context.Context, db *DB) (int64, error)

Types

type Bar

type Bar struct {
	Id   int64
	Name string
}

type Bar_Id_Field

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

func Bar_Id

func Bar_Id(v int64) Bar_Id_Field

type Bar_Name_Field

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

func Bar_Name

func Bar_Name(v string) Bar_Name_Field

type Bar_Update_Fields

type Bar_Update_Fields struct {
}

type Baz

type Baz struct {
	Id   int64
	Name string
}

type Baz_Id_Field

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

func Baz_Id

func Baz_Id(v int64) Baz_Id_Field

type Baz_Name_Field

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

func Baz_Name

func Baz_Name(v string) Baz_Name_Field

type Baz_Update_Fields

type Baz_Update_Fields struct {
}

type DB

type DB struct {
	*sql.DB

	Hooks struct {
		Now func() time.Time
	}
	// contains filtered or unexported fields
}

func Open

func Open(driver, source string) (db *DB, err error)

func (*DB) Close

func (obj *DB) Close() (err error)

func (*DB) Open

func (obj *DB) Open(ctx context.Context) (*Tx, error)

type DBMethods

type DBMethods interface {
	Methods

	Schema() []string
	DropSchema() []string

	Rebind(sql string) string
}

type Error

type Error struct {
	Err         error
	Code        ErrorCode
	Driver      string
	Constraint  string
	QuerySuffix string
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ErrorCode

type ErrorCode int
const (
	ErrorCode_Unknown ErrorCode = iota
	ErrorCode_UnsupportedDriver
	ErrorCode_NoRows
	ErrorCode_TxDone
	ErrorCode_TooManyRows
	ErrorCode_ConstraintViolation
	ErrorCode_EmptyUpdate
)

type Foo

type Foo struct {
	Id    int64
	BarId int64
	BazId int64
	Name  string
}

type Foo_BarId_Field

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

func Foo_BarId

func Foo_BarId(v int64) Foo_BarId_Field

type Foo_Bar_Baz_Row

type Foo_Bar_Baz_Row struct {
	Foo Foo
	Bar Bar
	Baz Baz
}

type Foo_BazId_Field

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

func Foo_BazId

func Foo_BazId(v int64) Foo_BazId_Field

type Foo_Id_Field

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

func Foo_Id

func Foo_Id(v int64) Foo_Id_Field

type Foo_Name_Field

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

func Foo_Name

func Foo_Name(v string) Foo_Name_Field

type Foo_Update_Fields

type Foo_Update_Fields struct {
	Name Foo_Name_Field
}

type Methods

type Methods interface {
	All_Foo_Bar_Baz(ctx context.Context) (
		rows []*Foo_Bar_Baz_Row, err error)

	Delete_Foo_By_Bar_Name(ctx context.Context,
		bar_name Bar_Name_Field) (
		deleted bool, err error)

	Update_Foo_By_Bar_Name(ctx context.Context,
		bar_name Bar_Name_Field,
		update Foo_Update_Fields) (
		foo *Foo, err error)
}

type Tx

type Tx struct {
	Tx *sql.Tx
	// contains filtered or unexported fields
}

func (*Tx) ExecContext

func (tx *Tx) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)

func (*Tx) QueryContext

func (tx *Tx) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)

func (*Tx) QueryRowContext

func (tx *Tx) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row

type TxMethods

type TxMethods interface {
	Methods

	Rebind(s string) string
	Commit() error
	Rollback() error
}

Jump to

Keyboard shortcuts

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