Documentation ¶
Index ¶
- Constants
- Variables
- type Session
- func (s *Session) HasPK() bool
- func (s *Session) PKPointer() interface{}
- func (s *Session) PKValue() interface{}
- func (s *Session) Pointers() []interface{}
- func (s *Session) SetPK(pk interface{})
- func (s Session) String() string
- func (s *Session) Table() reform.Table
- func (s *Session) Values() []interface{}
- func (s *Session) View() reform.View
- type User
- func (s *User) HasPK() bool
- func (s *User) PKPointer() interface{}
- func (s *User) PKValue() interface{}
- func (s *User) Pointers() []interface{}
- func (s *User) SetPK(pk interface{})
- func (s User) String() string
- func (s *User) Table() reform.Table
- func (s *User) Values() []interface{}
- func (s *User) View() reform.View
Constants ¶
const ( // UserFieldNameUsername username field name UserFieldNameUsername string = "username" )
Variables ¶
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.
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) 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) Table ¶
func (s *Session) Table() reform.Table
Table returns Table object for that record.
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) 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) Table ¶
func (s *User) Table() reform.Table
Table returns Table object for that record.