models

package
v0.0.0-...-70d48f5 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2018 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PubHealth = transition.New(&Pub{})
)

Functions

func CheckPub

func CheckPub(value interface{}, tx *gorm.DB) (err error)

Types

type Address

type Address struct {
	gorm.Model
	Pub   Pub
	PubID uint
	Addr  string
}

Composite primary keys can't be created on SQLite tables

 https://github.com/jinzhu/gorm/issues/1037

	Host  string `gorm:"primary_key"`
	Port  int    `gorm:"primary_key"`

type AuthIdentity

type AuthIdentity struct {
	gorm.Model
	Provider          string // phone, email, wechat, github...
	UID               string
	EncryptedPassword string
	AuthInfo          AuthInfo
	UserID            string
	State             string // unconfirmed, confirmed, expired

	Password             string `gorm:"-"`
	PasswordConfirmation string `gorm:"-"`
}

type AuthInfo

type AuthInfo struct {
	PhoneVerificationCode       string
	PhoneVerificationCodeExpiry *time.Time
	PhoneConfirmedAt            *time.Time
	UnconfirmedPhone            string // only use when changing phone number

	EmailConfirmedAt *time.Time
	UnconfirmedEmail string // only use when changing email

	SignInCount uint
	SignLogs    []SignLog
}

type AvatarImageStorage

type AvatarImageStorage struct{ oss.OSS }

func (AvatarImageStorage) GetSizes

func (AvatarImageStorage) GetSizes() map[string]*media.Size

type Check

type Check struct {
	ID         uint `gorm:"primary_key"`
	CreatedAt  time.Time
	UpdatedAt  time.Time
	Pub        Pub
	PubID      uint
	Addr       Address
	AddrID     uint
	Took       time.Duration
	State      State
	Error      string
	Sent, Rcvd uint64
}

type MediaLibrary

type MediaLibrary struct {
	Title string
	media_library.MediaLibrary
}

type Pub

type Pub struct {
	gorm.Model
	Key       string `gorm:"unique_index"`
	Addresses []Address
	transition.Transition
}

type Setting

type Setting struct {
	gorm.Model
	l10n.Locale
}

type SignLog

type SignLog struct {
	UserAgent string
	At        *time.Time
	IP        string
}

//////////////////////////////////////////////////////////////////////////////

type State

type State uint
const (
	Unavailable       State = iota // means something like dns failure or connection refused
	KeyExchanged                   // dialed, past the SHS kex
	Muxed                          // did open a muxrpc exchange
	CommandsExchanged              //did blobs.createWants or gossip.ping or createLogStream

)

func (State) String

func (i State) String() string

type User

type User struct {
	gorm.Model
	Email    string `form:"email"`
	Password string
	Name     string `form:"name"`
	Role     string
	Avatar   AvatarImageStorage
}

func (User) AvailableLocales

func (user User) AvailableLocales() []string

func (User) DisplayName

func (user User) DisplayName() string

Source Files

  • identity.go
  • media_library.go
  • pub.go
  • setting.go
  • state_string.go
  • user.go

Jump to

Keyboard shortcuts

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