boil

package
v2.7.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 24, 2018 License: BSD-3-Clause Imports: 4 Imported by: 775

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DebugMode = false

DebugMode is a flag controlling whether generated sql statements and debug information is outputted to the DebugWriter handle

NOTE: This should be disabled in production to avoid leaking sensitive data

View Source
var DebugWriter io.Writer = os.Stdout

DebugWriter is where the debug output will be sent if DebugMode is true

Functions

func GetLocation

func GetLocation() *time.Location

GetLocation retrieves the global timestamp Location. This is the timezone used by the generated package for the automated setting of created_at and updated_at columns if the package was not generated with the --no-auto-timestamps flag.

func IsBoilErr

func IsBoilErr(err error) bool

IsBoilErr checks if err is a boilErr

func SetDB

func SetDB(db Executor)

SetDB initializes the database handle for all template db interactions

func SetLocation

func SetLocation(loc *time.Location)

SetLocation sets the global timestamp Location. This is the timezone used by the generated package for the automated setting of created_at and updated_at columns. If the package was generated with the --no-auto-timestamps flag then this function has no effect.

func WrapErr

func WrapErr(err error) error

WrapErr wraps err in a boilErr

Types

type Beginner

type Beginner interface {
	Begin() (*sql.Tx, error)
}

Beginner begins transactions.

type Executor

type Executor interface {
	Exec(query string, args ...interface{}) (sql.Result, error)
	Query(query string, args ...interface{}) (*sql.Rows, error)
	QueryRow(query string, args ...interface{}) *sql.Row
}

Executor can perform SQL queries.

func GetDB

func GetDB() Executor

GetDB retrieves the global state database handle

type HookPoint

type HookPoint int

HookPoint is the point in time at which we hook

const (
	BeforeInsertHook HookPoint = iota + 1
	BeforeUpdateHook
	BeforeDeleteHook
	BeforeUpsertHook
	AfterInsertHook
	AfterSelectHook
	AfterUpdateHook
	AfterDeleteHook
	AfterUpsertHook
)

the hook point constants

type Transactor

type Transactor interface {
	Commit() error
	Rollback() error

	Executor
}

Transactor can commit and rollback, on top of being able to execute queries.

func Begin

func Begin() (Transactor, error)

Begin a transaction

Jump to

Keyboard shortcuts

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