db

package
v0.0.0-...-3aa45ce Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: MIT Imports: 17 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 ...interface{})
)

Functions

func DeleteAll

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

Types

type Campaign

type Campaign struct {
	Pk        int64
	Id        string
	CreatedAt time.Time
	UpdatedAt time.Time
	Industry  string
}

type Campaign_CreatedAt_Field

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

func Campaign_CreatedAt

func Campaign_CreatedAt(v time.Time) Campaign_CreatedAt_Field

type Campaign_Id_Field

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

func Campaign_Id

func Campaign_Id(v string) Campaign_Id_Field

type Campaign_Industry_Field

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

func Campaign_Industry

func Campaign_Industry(v string) Campaign_Industry_Field

type Campaign_Pk_Field

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

func Campaign_Pk

func Campaign_Pk(v int64) Campaign_Pk_Field

type Campaign_Update_Fields

type Campaign_Update_Fields struct {
}

type Campaign_UpdatedAt_Field

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

func Campaign_UpdatedAt

func Campaign_UpdatedAt(v time.Time) Campaign_UpdatedAt_Field

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 OpenDB

func OpenDB(ctx context.Context) (*DB, error)

OpenDB returns a *DB or an error

func (*DB) Close

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

func (*DB) Migrate

func (db *DB) Migrate(driver string, migrations string) error

Migrate runs all of the migrations in `./migrations` against the DB on startup

func (*DB) NewRx

func (obj *DB) NewRx() *Rx

func (*DB) Open

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

func (*DB) WithTx

func (db *DB) WithTx(ctx context.Context,
	fn func(context.Context, *Tx) error) (err error)

WithTx gives you a callback function that exposes any errors that occur

type DBMethods

type DBMethods interface {
	Methods

	Schema() 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

type ErrorCode

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

type Lead

type Lead struct {
	Pk        int64
	CreatedAt time.Time
	UpdatedAt time.Time
	Industry  string
}

type Lead_CreatedAt_Field

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

func Lead_CreatedAt

func Lead_CreatedAt(v time.Time) Lead_CreatedAt_Field

type Lead_Industry_Field

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

func Lead_Industry

func Lead_Industry(v string) Lead_Industry_Field

type Lead_Pk_Field

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

func Lead_Pk

func Lead_Pk(v int64) Lead_Pk_Field

type Lead_Update_Fields

type Lead_Update_Fields struct {
}

type Lead_UpdatedAt_Field

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

func Lead_UpdatedAt

func Lead_UpdatedAt(v time.Time) Lead_UpdatedAt_Field

type Methods

type Methods interface {
}

type Rx

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

func (*Rx) Commit

func (rx *Rx) Commit() (err error)

func (*Rx) Rebind

func (rx *Rx) Rebind(s string) string

func (*Rx) Rollback

func (rx *Rx) Rollback() (err error)

func (*Rx) UnsafeTx

func (rx *Rx) UnsafeTx(ctx context.Context) (unsafe_tx *sql.Tx, err error)

type Tx

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

type TxMethods

type TxMethods interface {
	Methods

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

type User

type User struct {
	Pk        int64
	CreatedAt time.Time
	UpdatedAt time.Time
	Id        string
	Name      string
}

type User_CreatedAt_Field

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

func User_CreatedAt

func User_CreatedAt(v time.Time) User_CreatedAt_Field

type User_Id_Field

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

func User_Id

func User_Id(v string) User_Id_Field

type User_Name_Field

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

func User_Name

func User_Name(v string) User_Name_Field

type User_Pk_Field

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

func User_Pk

func User_Pk(v int64) User_Pk_Field

type User_Update_Fields

type User_Update_Fields struct {
}

type User_UpdatedAt_Field

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

func User_UpdatedAt

func User_UpdatedAt(v time.Time) User_UpdatedAt_Field

Jump to

Keyboard shortcuts

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