models

package
v0.0.0-...-725bf3e Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDetail

func AddDetail(detail string, max int, comment string) string

func AddIndex

func AddIndex(detail string, max int, name string) string

func AddUser

func AddUser(u *User)

func NewSession

func NewSession() *session.Manager

func RunMigrate

func RunMigrate()

func Session

func Session() *session.Manager

func SetMigrate

func SetMigrate(table interface{})

Types

type Base

type Base struct {
	ID        uuid.UUID `gorm:"primary_key;type:varchar(36)"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

func (*Base) BeforeCreate

func (b *Base) BeforeCreate(scope *gorm.Scope) error

func (Base) IsNil

func (b Base) IsNil() bool

type CommentDetail

type CommentDetail struct {
	NickName string
	Comment  string
}

type DB

type DB = gorm.DB

func CreateDB

func CreateDB() *DB

func ORM

func ORM() *DB

type Talk

type Talk struct {
	Base
	UserID        uuid.UUID `gorm:"type:varchar(36)"`
	TalkNameHex   string    //talk主题
	Now           uuid.UUID `gorm:"type:varchar(36)"`
	Max           int
	DetailIndex   string `gorm:"type:varchar(2048)"`
	CommentDetail string `gorm:"type:varchar(4096)"`
}

func FindAllTalk

func FindAllTalk(id string) []Talk

func FindByNow

func FindByNow(now string) []Talk

func FindByTalkNameHex

func FindByTalkNameHex(hex string) Talk

func FindTalkByHex

func FindTalkByHex(uuid string) *Talk

func NewTalk

func NewTalk() *Talk

func (*Talk) AddComment

func (t *Talk) AddComment(name string, comment string)

func (*Talk) Create

func (t *Talk) Create() error

func (*Talk) ToComment

func (t *Talk) ToComment() []CommentDetail

func (*Talk) ToString

func (t *Talk) ToString() string

type User

type User struct {
	Base
	NickNameHex string
}

func FindUser

func FindUser(uuid string) *User

func FindUserByHex

func FindUserByHex(id string) *User

func NewUser

func NewUser() *User

func RandomUser

func RandomUser() *User

func Users

func Users() []User

Jump to

Keyboard shortcuts

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