examples

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	ID    int64  `db:"id" json:"id"`
	Name  string `db:"name" json:"name"`
	Email string `db:"email" json:"email"`
	Age   int    `db:"age" json:"age"`

	RowCount int64 `db:"row_count" json:"-"`
}

type UserQ

type UserQ struct {
	*db.SQLConn
	db.Table
}

UserQ is a interface for interacting with the `users` table.

func NewUserQ

func NewUserQ(conn *db.SQLConn) *UserQ

NewUserQ returns the new instance of the `UserQ`.

func (*UserQ) ByAge

func (q *UserQ) ByAge(age int) *UserQ

ByAge adds in the query filter by the `age` column.

func (*UserQ) Insert

func (q *UserQ) Insert(user *User) error

Insert adds new row into the `users` table.

func (*UserQ) Select

func (q *UserQ) Select() ([]User, error)

Select gets all records

func (*UserQ) SetPage

func (q *UserQ) SetPage(pq *db.PageQuery) *UserQ

SetPage sets the limitation of select by the parameters from `db.PageQuery`.

Jump to

Keyboard shortcuts

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