Documentation
¶
Index ¶
- type Book
- type BookBrick
- func (b *BookBrick) AddOne(args *Book) (sql.Result, error)
- func (b *BookBrick) ComplexUpdate(args *Book) (int64, error)
- func (b *BookBrick) CountBooks(dest interface{}, uid interface{}) error
- func (b *BookBrick) CreateBook() error
- func (b *BookBrick) DeleteById(id interface{}) (int64, error)
- func (b *BookBrick) DeleteByIdAndUid(args interface{}) (int64, error)
- func (b *BookBrick) SelectAll(dest interface{}) error
- func (b *BookBrick) SelectById(dest interface{}, id interface{}) error
- func (b *BookBrick) SelectByUid(dest interface{}, uid interface{}) error
- func (b *BookBrick) UpdateSomeThing(args *Book) (int64, error)
- type BookBrickTx
- type BrickTx
- type SqlBrick
- type User
- type UserBrick
- type UserBrickTx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Book ¶
type Book struct { Id int32 `db:"id"` Uid int32 `db:"uid"` Name string `db:"name"` Content typex.NullString `db:"content"` CreateTime typex.NullTime `db:"create_time"` Price int32 `db:"price"` }
Type definition for Book which defined in sql file. This can be used as a model in database operation.
type BookBrick ¶
type BookBrick struct {
// contains filtered or unexported fields
}
Type definition for BookBrick. This brick will contains all database operation from given sql file. Each sql file will have only one brick.
func (*BookBrick) ComplexUpdate ¶
ComplexUpdate an example to show complex update. Second line comment.
func (*BookBrick) CountBooks ¶
CountBooks generated by sqlbrick, select data from database.
func (*BookBrick) CreateBook ¶
CreateBook create table if not exsited
func (*BookBrick) DeleteById ¶
DeleteById an example to show DeleteById.
func (*BookBrick) DeleteByIdAndUid ¶ added in v0.2.0
DeleteByIdAndUid generated by sqlbrick, delete data from database. Affected rows will return if there's no error.
func (*BookBrick) SelectById ¶
SelectById an example to show SelectById.
func (*BookBrick) SelectByUid ¶
SelectByUid generated by sqlbrick, select data from database.
type BookBrickTx ¶
type BookBrickTx struct {
// contains filtered or unexported fields
}
Type definition for Book transaction. This aims at sql transaction.
func (*BookBrickTx) TxDeleteById ¶
func (b *BookBrickTx) TxDeleteById(id interface{}) (int64, error)
TxDeleteById generated by sqlbrick, delete data from database. Affected rows will return if there's no error.
func (*BookBrickTx) TxInsert ¶
func (b *BookBrickTx) TxInsert(args *Book) (sql.Result, error)
TxInsert generated by sqlbrick, insert data into database.
func (*BookBrickTx) TxSelect ¶
func (b *BookBrickTx) TxSelect(dest interface{}, uid interface{}) error
TxSelect generated by sqlbrick, select data from database.
type BrickTx ¶
type BrickTx struct { Book *BookBrickTx User *UserBrickTx // contains filtered or unexported fields }
Type definition for brick transaction. This aims at sql transaction. If you want a transaction, then invoke 'Begin' to get this struct.
type SqlBrick ¶
Type definition for SqlBrick. It contains all bricks depend on the number of sql files. It also wraps some sqlx func for for convenience.
func NewSqlBrick ¶
NewSqlBrick create a new SqlBrick to operate all bricks.
type User ¶
Type definition for User which defined in sql file. This can be used as a model in database operation.
type UserBrick ¶
type UserBrick struct {
// contains filtered or unexported fields
}
Type definition for UserBrick. This brick will contains all database operation from given sql file. Each sql file will have only one brick.
func (*UserBrick) CreateUser ¶
CreateUser generated by sqlbrick, used to operate database table.
func (*UserBrick) SelectById ¶
SelectById name: SelectById
func (*UserBrick) UnionSelect ¶ added in v0.2.0
UnionSelect generated by sqlbrick, select data from database.
type UserBrickTx ¶
type UserBrickTx struct {
// contains filtered or unexported fields
}
Type definition for User transaction. This aims at sql transaction.
func (*UserBrickTx) TxDelete ¶
func (b *UserBrickTx) TxDelete(id interface{}) (int64, error)
TxDelete generated by sqlbrick, delete data from database. Affected rows will return if there's no error.