db

package
v0.0.0-...-d79b3d1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB *sql.DB
)
View Source
var (
	// Default is a database connection reference.
	Default *defaultConnection
)

Functions

func DBStart

func DBStart()

func DBStop

func DBStop()

func DBUserGroupsCreate

func DBUserGroupsCreate()

func DBUserGroupsInsert

func DBUserGroupsInsert()

func DBUsersCreate

func DBUsersCreate()

func DBUsersInsertJoes

func DBUsersInsertJoes()

func InitDefault

func InitDefault(db *sql.DB)

InitDefault initializes the connection `Default:`.

func NewGroupResultSet

func NewGroupResultSet(rs ceous.ResultSet, err error) (*groupResultSet, error)

NewGroupResultSet create a new instance of the specialized `ceous.ResultSet` for the model `Group`.

func NewUserGroupResultSet

func NewUserGroupResultSet(rs ceous.ResultSet, err error) (*userGroupResultSet, error)

NewUserGroupResultSet create a new instance of the specialized `ceous.ResultSet` for the model `UserGroup`.

func NewUserResultSet

func NewUserResultSet(rs ceous.ResultSet, err error) (*userResultSet, error)

NewUserResultSet create a new instance of the specialized `ceous.ResultSet` for the model `User`.

Types

type Connection

type Connection interface {
	ceous.DBRunner
	Creator
}

type Creator

type Creator interface {
	// UserQuery creates a new query related with the connection set.
	UserQuery(options ...ceous.CeousOption) *UserQuery
	// GroupQuery creates a new query related with the connection set.
	GroupQuery(options ...ceous.CeousOption) *GroupQuery
	// UserGroupQuery creates a new query related with the connection set.
	UserGroupQuery(options ...ceous.CeousOption) *UserGroupQuery
	// UserStore creates a new store related with the connection set.
	UserStore(options ...ceous.CeousOption) *UserStore
	// GroupStore creates a new store related with the connection set.
	GroupStore(options ...ceous.CeousOption) *GroupStore
	// UserGroupStore creates a new store related with the connection set.
	UserGroupStore(options ...ceous.CeousOption) *UserGroupStore
}

type GroupQuery

type GroupQuery struct {
	*ceous.BaseQuery
}

GroupQuery is the query for the model `GroupQuery`.

func NewGroupQuery

func NewGroupQuery(options ...ceous.CeousOption) *GroupQuery

NewGroupQuery creates a new query for model `GroupQuery`.

func (*GroupQuery) All

func (q *GroupQuery) All() ([]*tests.Group, error)

All return all records that match the query.

func (*GroupQuery) ByID

func (q *GroupQuery) ByID(value int) *GroupQuery

ByID add a filter by `ID`.

func (*GroupQuery) ByName

func (q *GroupQuery) ByName(value string) *GroupQuery

ByName add a filter by `Name`.

func (*GroupQuery) ExcludeFields

func (q *GroupQuery) ExcludeFields(fields ...ceous.SchemaField) *GroupQuery

ExcludeFields defines what fields should not be selected from the database.

func (*GroupQuery) For

For add a FOR [UPDATE|NO KEY UPDATE|SHARE|KEY SHARE] [NOWAIT|SKIP LOCKED] directive for the key.

func (*GroupQuery) Limit

func (q *GroupQuery) Limit(limit uint64) *GroupQuery

func (*GroupQuery) Offset

func (q *GroupQuery) Offset(offset uint64) *GroupQuery

func (*GroupQuery) One

func (q *GroupQuery) One() (m tests.Group, err error)

One results only one record matching the query.

func (*GroupQuery) OrderBy

func (q *GroupQuery) OrderBy(fields ...interface{}) *GroupQuery

func (*GroupQuery) Select

func (q *GroupQuery) Select(fields ...ceous.SchemaField) *GroupQuery

Select defines what fields should be selected from the database.

func (*GroupQuery) Where

func (q *GroupQuery) Where(pred interface{}, args ...interface{}) *GroupQuery

Where defines the conditions for

type GroupStore

type GroupStore struct {
	*ceous.BaseStore
}

GroupStore is the query for the store `Group`.

func NewGroupStore

func NewGroupStore(options ...ceous.CeousOption) *GroupStore

NewGroupStore creates a new query for model `Group`.

func (*GroupStore) Insert

func (store *GroupStore) Insert(record *tests.Group, fields ...ceous.SchemaField) error

func (*GroupStore) Update

func (store *GroupStore) Update(record *tests.Group, fields ...ceous.SchemaField) (int64, error)

type Transaction

type Transaction struct {
	*ceous.BaseTxRunner
}

func NewTransaction

func NewTransaction(tx *ceous.BaseTxRunner) *Transaction

func (*Transaction) GroupQuery

func (c *Transaction) GroupQuery(options ...ceous.CeousOption) *GroupQuery

GroupQuery creates a new query from a transaction.

func (*Transaction) GroupStore

func (c *Transaction) GroupStore(options ...ceous.CeousOption) *GroupStore

GroupStore creates a new store from a transaction.

func (*Transaction) UserGroupQuery

func (c *Transaction) UserGroupQuery(options ...ceous.CeousOption) *UserGroupQuery

UserGroupQuery creates a new query from a transaction.

func (*Transaction) UserGroupStore

func (c *Transaction) UserGroupStore(options ...ceous.CeousOption) *UserGroupStore

UserGroupStore creates a new store from a transaction.

func (*Transaction) UserQuery

func (c *Transaction) UserQuery(options ...ceous.CeousOption) *UserQuery

UserQuery creates a new query from a transaction.

func (*Transaction) UserStore

func (c *Transaction) UserStore(options ...ceous.CeousOption) *UserStore

UserStore creates a new store from a transaction.

type UserGroupQuery

type UserGroupQuery struct {
	*ceous.BaseQuery
}

UserGroupQuery is the query for the model `UserGroupQuery`.

func NewUserGroupQuery

func NewUserGroupQuery(options ...ceous.CeousOption) *UserGroupQuery

NewUserGroupQuery creates a new query for model `UserGroupQuery`.

func (*UserGroupQuery) All

func (q *UserGroupQuery) All() ([]*tests.UserGroup, error)

All return all records that match the query.

func (*UserGroupQuery) ByAdmin

func (q *UserGroupQuery) ByAdmin(value bool) *UserGroupQuery

ByAdmin add a filter by `Admin`.

func (*UserGroupQuery) ByIDGroupID

func (q *UserGroupQuery) ByIDGroupID(value int) *UserGroupQuery

ByGroupID add a filter by `GroupID`.

func (*UserGroupQuery) ByIDUserID

func (q *UserGroupQuery) ByIDUserID(value int) *UserGroupQuery

ByUserID add a filter by `UserID`.

func (*UserGroupQuery) ExcludeFields

func (q *UserGroupQuery) ExcludeFields(fields ...ceous.SchemaField) *UserGroupQuery

ExcludeFields defines what fields should not be selected from the database.

func (*UserGroupQuery) For

For add a FOR [UPDATE|NO KEY UPDATE|SHARE|KEY SHARE] [NOWAIT|SKIP LOCKED] directive for the key.

func (*UserGroupQuery) Limit

func (q *UserGroupQuery) Limit(limit uint64) *UserGroupQuery

func (*UserGroupQuery) Offset

func (q *UserGroupQuery) Offset(offset uint64) *UserGroupQuery

func (*UserGroupQuery) One

func (q *UserGroupQuery) One() (m tests.UserGroup, err error)

One results only one record matching the query.

func (*UserGroupQuery) OrderBy

func (q *UserGroupQuery) OrderBy(fields ...interface{}) *UserGroupQuery

func (*UserGroupQuery) Select

func (q *UserGroupQuery) Select(fields ...ceous.SchemaField) *UserGroupQuery

Select defines what fields should be selected from the database.

func (*UserGroupQuery) Where

func (q *UserGroupQuery) Where(pred interface{}, args ...interface{}) *UserGroupQuery

Where defines the conditions for

func (*UserGroupQuery) WithUser

func (q *UserGroupQuery) WithUser() *UserGroupQuery

type UserGroupStore

type UserGroupStore struct {
	*ceous.BaseStore
}

UserGroupStore is the query for the store `UserGroup`.

func NewUserGroupStore

func NewUserGroupStore(options ...ceous.CeousOption) *UserGroupStore

NewUserGroupStore creates a new query for model `UserGroup`.

func (*UserGroupStore) Insert

func (store *UserGroupStore) Insert(record *tests.UserGroup, fields ...ceous.SchemaField) error

func (*UserGroupStore) Update

func (store *UserGroupStore) Update(record *tests.UserGroup, fields ...ceous.SchemaField) (int64, error)

type UserGroupUserRelation

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

func NewUserGroupUserRelation

func NewUserGroupUserRelation(runner ceous.DBRunner) *UserGroupUserRelation

func (*UserGroupUserRelation) Aggregate

func (relation *UserGroupUserRelation) Aggregate(record ceous.Record) error

func (*UserGroupUserRelation) Realize

func (relation *UserGroupUserRelation) Realize() error

type UserQuery

type UserQuery struct {
	*ceous.BaseQuery
}

UserQuery is the query for the model `UserQuery`.

func NewUserQuery

func NewUserQuery(options ...ceous.CeousOption) *UserQuery

NewUserQuery creates a new query for model `UserQuery`.

func (*UserQuery) All

func (q *UserQuery) All() ([]*tests.User, error)

All return all records that match the query.

func (*UserQuery) ByAddressCity

func (q *UserQuery) ByAddressCity(value string) *UserQuery

ByCity add a filter by `City`.

func (*UserQuery) ByAddressNumber

func (q *UserQuery) ByAddressNumber(value string) *UserQuery

ByNumber add a filter by `Number`.

func (*UserQuery) ByAddressState

func (q *UserQuery) ByAddressState(value string) *UserQuery

ByState add a filter by `State`.

func (*UserQuery) ByAddressStreet

func (q *UserQuery) ByAddressStreet(value string) *UserQuery

ByStreet add a filter by `Street`.

func (*UserQuery) ByCreatedAt

func (q *UserQuery) ByCreatedAt(value time.Time) *UserQuery

ByCreatedAt add a filter by `CreatedAt`.

func (*UserQuery) ByID

func (q *UserQuery) ByID(value int) *UserQuery

ByID add a filter by `ID`.

func (*UserQuery) ByName

func (q *UserQuery) ByName(value string) *UserQuery

ByName add a filter by `Name`.

func (*UserQuery) ByPassword

func (q *UserQuery) ByPassword(value string) *UserQuery

ByPassword add a filter by `Password`.

func (*UserQuery) ByRole

func (q *UserQuery) ByRole(value string) *UserQuery

ByRole add a filter by `Role`.

func (*UserQuery) ByUpdatedAt

func (q *UserQuery) ByUpdatedAt(value time.Time) *UserQuery

ByUpdatedAt add a filter by `UpdatedAt`.

func (*UserQuery) ByWorkCity

func (q *UserQuery) ByWorkCity(value string) *UserQuery

ByCity add a filter by `City`.

func (*UserQuery) ByWorkNumber

func (q *UserQuery) ByWorkNumber(value string) *UserQuery

ByNumber add a filter by `Number`.

func (*UserQuery) ByWorkState

func (q *UserQuery) ByWorkState(value string) *UserQuery

ByState add a filter by `State`.

func (*UserQuery) ByWorkStreet

func (q *UserQuery) ByWorkStreet(value string) *UserQuery

ByStreet add a filter by `Street`.

func (*UserQuery) ExcludeFields

func (q *UserQuery) ExcludeFields(fields ...ceous.SchemaField) *UserQuery

ExcludeFields defines what fields should not be selected from the database.

func (*UserQuery) For

func (q *UserQuery) For(t ceous.SelectForType, lockingType ...ceous.SelectForLockingType) *UserQuery

For add a FOR [UPDATE|NO KEY UPDATE|SHARE|KEY SHARE] [NOWAIT|SKIP LOCKED] directive for the key.

func (*UserQuery) Limit

func (q *UserQuery) Limit(limit uint64) *UserQuery

func (*UserQuery) Offset

func (q *UserQuery) Offset(offset uint64) *UserQuery

func (*UserQuery) One

func (q *UserQuery) One() (m tests.User, err error)

One results only one record matching the query.

func (*UserQuery) OrderBy

func (q *UserQuery) OrderBy(fields ...interface{}) *UserQuery

func (*UserQuery) Select

func (q *UserQuery) Select(fields ...ceous.SchemaField) *UserQuery

Select defines what fields should be selected from the database.

func (*UserQuery) Where

func (q *UserQuery) Where(pred interface{}, args ...interface{}) *UserQuery

Where defines the conditions for

type UserStore

type UserStore struct {
	*ceous.BaseStore
}

UserStore is the query for the store `User`.

func NewUserStore

func NewUserStore(options ...ceous.CeousOption) *UserStore

NewUserStore creates a new query for model `User`.

func (*UserStore) Insert

func (store *UserStore) Insert(record *tests.User, fields ...ceous.SchemaField) error

func (*UserStore) Update

func (store *UserStore) Update(record *tests.User, fields ...ceous.SchemaField) (int64, error)

Jump to

Keyboard shortcuts

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