dbx

package
v1.27.5 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: AGPL-3.0 Imports: 18 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{})
)
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 DB

type DB struct {
	tagsql.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) NewRx

func (obj *DB) NewRx() *Rx

func (*DB) Open

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

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 Member

type Member struct {
	Id           []byte
	Email        string
	Name         string
	PasswordHash []byte
	CreatedAt    time.Time
}

type Member_CreatedAt_Field

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

func Member_CreatedAt

func Member_CreatedAt(v time.Time) Member_CreatedAt_Field

type Member_Email_Field

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

func Member_Email

func Member_Email(v string) Member_Email_Field

type Member_Id_Field

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

func Member_Id

func Member_Id(v []byte) Member_Id_Field

type Member_Name_Field

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

func Member_Name

func Member_Name(v string) Member_Name_Field

type Member_PasswordHash_Field

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

func Member_PasswordHash

func Member_PasswordHash(v []byte) Member_PasswordHash_Field

type Member_Update_Fields

type Member_Update_Fields struct {
	Email        Member_Email_Field
	Name         Member_Name_Field
	PasswordHash Member_PasswordHash_Field
}

type Methods

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

	Create_Member(ctx context.Context,
		member_id Member_Id_Field,
		member_email Member_Email_Field,
		member_name Member_Name_Field,
		member_password_hash Member_PasswordHash_Field) (
		member *Member, err error)

	Create_Node(ctx context.Context,
		node_id Node_Id_Field,
		node_name Node_Name_Field,
		node_public_address Node_PublicAddress_Field,
		node_api_secret Node_ApiSecret_Field) (
		node *Node, err error)

	Delete_Member_By_Id(ctx context.Context,
		member_id Member_Id_Field) (
		deleted bool, err error)

	Delete_Node_By_Id(ctx context.Context,
		node_id Node_Id_Field) (
		deleted bool, err error)

	Get_Member_By_Email(ctx context.Context,
		member_email Member_Email_Field) (
		member *Member, err error)

	Get_Member_By_Id(ctx context.Context,
		member_id Member_Id_Field) (
		member *Member, err error)

	Get_Node_By_Id(ctx context.Context,
		node_id Node_Id_Field) (
		node *Node, err error)

	UpdateNoReturn_Node_By_Id(ctx context.Context,
		node_id Node_Id_Field,
		update Node_Update_Fields) (
		err error)

	Update_Member_By_Id(ctx context.Context,
		member_id Member_Id_Field,
		update Member_Update_Fields) (
		member *Member, err error)

	Update_Node_By_Id(ctx context.Context,
		node_id Node_Id_Field,
		update Node_Update_Fields) (
		node *Node, err error)
}

type Node

type Node struct {
	Id            []byte
	Name          string
	PublicAddress string
	ApiSecret     []byte
}

type Node_ApiSecret_Field

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

func Node_ApiSecret

func Node_ApiSecret(v []byte) Node_ApiSecret_Field

type Node_Id_Field

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

func Node_Id

func Node_Id(v []byte) Node_Id_Field

type Node_Name_Field

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

func Node_Name

func Node_Name(v string) Node_Name_Field

type Node_PublicAddress_Field

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

func Node_PublicAddress

func Node_PublicAddress(v string) Node_PublicAddress_Field

type Node_Update_Fields

type Node_Update_Fields struct {
	Name Node_Name_Field
}

type Rx

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

func (*Rx) All_Node added in v1.18.1

func (rx *Rx) All_Node(ctx context.Context) (
	rows []*Node, err error)

func (*Rx) Commit

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

func (*Rx) Create_Member

func (rx *Rx) Create_Member(ctx context.Context,
	member_id Member_Id_Field,
	member_email Member_Email_Field,
	member_name Member_Name_Field,
	member_password_hash Member_PasswordHash_Field) (
	member *Member, err error)

func (*Rx) Create_Node

func (rx *Rx) Create_Node(ctx context.Context,
	node_id Node_Id_Field,
	node_name Node_Name_Field,
	node_public_address Node_PublicAddress_Field,
	node_api_secret Node_ApiSecret_Field) (
	node *Node, err error)

func (*Rx) Delete_Member_By_Id

func (rx *Rx) Delete_Member_By_Id(ctx context.Context,
	member_id Member_Id_Field) (
	deleted bool, err error)

func (*Rx) Delete_Node_By_Id

func (rx *Rx) Delete_Node_By_Id(ctx context.Context,
	node_id Node_Id_Field) (
	deleted bool, err error)

func (*Rx) Get_Member_By_Email

func (rx *Rx) Get_Member_By_Email(ctx context.Context,
	member_email Member_Email_Field) (
	member *Member, err error)

func (*Rx) Get_Member_By_Id

func (rx *Rx) Get_Member_By_Id(ctx context.Context,
	member_id Member_Id_Field) (
	member *Member, err error)

func (*Rx) Get_Node_By_Id

func (rx *Rx) Get_Node_By_Id(ctx context.Context,
	node_id Node_Id_Field) (
	node *Node, 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 tagsql.Tx, err error)

func (*Rx) UpdateNoReturn_Node_By_Id added in v1.20.1

func (rx *Rx) UpdateNoReturn_Node_By_Id(ctx context.Context,
	node_id Node_Id_Field,
	update Node_Update_Fields) (
	err error)

func (*Rx) Update_Member_By_Id

func (rx *Rx) Update_Member_By_Id(ctx context.Context,
	member_id Member_Id_Field,
	update Member_Update_Fields) (
	member *Member, err error)

func (*Rx) Update_Node_By_Id added in v1.18.1

func (rx *Rx) Update_Node_By_Id(ctx context.Context,
	node_id Node_Id_Field,
	update Node_Update_Fields) (
	node *Node, err error)

type Tx

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

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