models

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNowAfter

func IsNowAfter(t time.Time) bool

現在時刻がtを過ぎているか

func StructTagToColumns

func StructTagToColumns(entity entity.Entity) []string

structタグ("db")の付いた全部のタグ(カラム名)を取得する

Types

type Auth

type Auth struct {
	Id        uint64 `db:"id"`
	UserId    uint64 `db:"user_id"`
	Source    string `db:"source"`
	SourceId  int    `db:"source_id"`
	Email     string `db:"email"`
	CreatedAt dbr.NullTime
	UpdatedAt dbr.NullTime
}

func NewAuth

func NewAuth() *Auth

func (*Auth) TableName

func (self *Auth) TableName() string

type CommonModel

type CommonModel struct {
	Id        dbr.NullInt64
	CreatedAt dbr.NullTime
	UpdatedAt dbr.NullTime
}

type Error

type Error interface {
	error
	StatusCode() int
	Message() string
}

func NewError

func NewError(code int, message string) Error

type User

type User struct {
	Id           dbr.NullInt64  `db:"id"`
	Name         string         `db:"name"`
	Email        string         `db:"email"`
	SessionToken string         `db:"session_token"`
	TokenExpire  dbr.NullTime   `db:"token_expire"`
	RegID        dbr.NullString `db:"registration_id"`
	LastLoginAt  dbr.NullTime   `db:"last_login_at"`
	CreatedAt    dbr.NullTime
	UpdatedAt    dbr.NullTime
}
var LoginUser *User

func NewUser

func NewUser() *User

func (*User) Auth

func (self *User) Auth(ou oauth.User) (string, error)

認証する

func (*User) FindUserBySessionToken

func (self *User) FindUserBySessionToken(token string) error

セッショントークンをキーにUserを検索する

func (*User) SaveRegistrationID

func (self *User) SaveRegistrationID(regID string) error

func (*User) TableName

func (self *User) TableName() string

func (*User) ToJson

func (self *User) ToJson() *json.UserJson

Jsonに変換する

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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