dao

package
v0.0.0-...-a5345d3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UserFieldNameUsername username field name
	UserFieldNameUsername string = "username"
)

Variables

View Source
var SessionTable = &sessionTableType{
	s: parse.StructInfo{Type: "Session", SQLSchema: "", SQLName: "sessions", Fields: []parse.FieldInfo{{Name: "ID", PKType: "string", Column: "id"}, {Name: "UserID", PKType: "", Column: "user_id"}, {Name: "RemoteAddr", PKType: "", Column: "ip"}, {Name: "CreatedAt", PKType: "", Column: "created_at"}, {Name: "ExpiresAt", PKType: "", Column: "expires_at"}}, PKFieldIndex: 0},
	z: new(Session).Values(),
}

SessionTable represents sessions view or table in SQL database.

View Source
var UserTable = &userTableType{
	s: parse.StructInfo{Type: "User", SQLSchema: "", SQLName: "users", Fields: []parse.FieldInfo{{Name: "ID", PKType: "string", Column: "id"}, {Name: "Username", PKType: "", Column: "username"}, {Name: "Password", PKType: "", Column: "password"}, {Name: "CreatedAt", PKType: "", Column: "created_at"}, {Name: "UpdatedAt", PKType: "", Column: "updated_at"}, {Name: "Role", PKType: "", Column: "role"}}, PKFieldIndex: 0},
	z: new(User).Values(),
}

UserTable represents users view or table in SQL database.

Functions

This section is empty.

Types

type Session

type Session struct {
	ID         string    `reform:"id,pk"`
	UserID     string    `reform:"user_id"`
	RemoteAddr string    `reform:"ip"`
	CreatedAt  time.Time `reform:"created_at"`
	ExpiresAt  time.Time `reform:"expires_at"`
}

Session temporary implementation of session to store in SQL database, but should be moved to appropriate storage.

func (*Session) HasPK

func (s *Session) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*Session) PKPointer

func (s *Session) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*Session) PKValue

func (s *Session) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*Session) Pointers

func (s *Session) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*Session) SetPK

func (s *Session) SetPK(pk interface{})

SetPK sets record primary key.

func (Session) String

func (s Session) String() string

String returns a string representation of this struct or record.

func (*Session) Table

func (s *Session) Table() reform.Table

Table returns Table object for that record.

func (*Session) Values

func (s *Session) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*Session) View

func (s *Session) View() reform.View

View returns View object for that struct.

type User

type User struct {
	ID        string     `reform:"id,pk"`
	Username  string     `reform:"username"`
	Password  string     `reform:"password"`
	CreatedAt time.Time  `reform:"created_at"`
	UpdatedAt *time.Time `reform:"updated_at"`
	Role      int        `reform:"role"`
}

User implement user DAO

func (*User) HasPK

func (s *User) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*User) PKPointer

func (s *User) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*User) PKValue

func (s *User) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*User) Pointers

func (s *User) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*User) SetPK

func (s *User) SetPK(pk interface{})

SetPK sets record primary key.

func (User) String

func (s User) String() string

String returns a string representation of this struct or record.

func (*User) Table

func (s *User) Table() reform.Table

Table returns Table object for that record.

func (*User) Values

func (s *User) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*User) View

func (s *User) View() reform.View

View returns View object for that struct.

Jump to

Keyboard shortcuts

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