models

package
v0.0.0-...-8707c32 Latest Latest
Warning

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

Go to latest
Published: May 27, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SourceGitHub = "github"
)

Possible types of sources

Variables

View Source
var UserTable = &userTableType{
	s: parse.StructInfo{Type: "User", SQLSchema: "", SQLName: "users", Fields: []parse.FieldInfo{{Name: "ID", Type: "int64", Column: "id"}, {Name: "Name", Type: "string", Column: "name"}, {Name: "Source", Type: "string", Column: "source"}, {Name: "SessionID", Type: "*string", Column: "session_id"}, {Name: "SessionData", Type: "*string", Column: "session_data"}, {Name: "Token", Type: "*string", Column: "token"}, {Name: "Cert", Type: "*string", Column: "ca_crt"}, {Name: "CreatedAt", Type: "time.Time", Column: "created_at"}, {Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"}}, PKFieldIndex: 0},
	z: new(User).Values(),
}

UserTable represents users view or table in SQL database.

Functions

This section is empty.

Types

type User

type User struct {
	ID          int64     `reform:"id,pk"`
	Name        string    `reform:"name"`
	Source      string    `reform:"source"`
	SessionID   *string   `reform:"session_id"`
	SessionData *string   `reform:"session_data"`
	Token       *string   `reform:"token"`
	Cert        *string   `reform:"ca_crt"`
	CreatedAt   time.Time `reform:"created_at"`
	UpdatedAt   time.Time `reform:"updated_at"`
}

func (*User) BeforeInsert

func (u *User) BeforeInsert() error

BeforeInsert set CreatedAt and UpdatedAt.

func (*User) BeforeUpdate

func (u *User) BeforeUpdate() error

BeforeUpdate set UpdatedAt.

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