model

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute []map[string]interface{}

使用map存取json数据,很灵活可以随时增减字段

func (*Attribute) Scan

func (a *Attribute) Scan(src interface{}) error

func (Attribute) Value

func (a Attribute) Value() (driver.Value, error)

type InfoMap

type InfoMap struct {
	Src   map[string]string
	Valid bool
}

func (*InfoMap) Scan

func (im *InfoMap) Scan(val interface{}) error

func (*InfoMap) Value

func (im *InfoMap) Value() (driver.Value, error)

type MicroBlog

type MicroBlog struct {
	ID        int
	Author    string
	Content   string
	Attribute Attribute
	CreateAt  *time.Time
	UpdateAt  *time.Time
}

type Server

type Server struct {
	gorm.Model
	IP         string     `gorm:"type:varchar(15)"`
	HostName   string     `gorm:"type:varchar(40)"`
	ServerTags ServerTags `gorm:"type:json"`
	State      string     `gorm:"type:varchar(10)"`
	Info       string     `gorm:"type:varchar(255)"`
}

type ServerTags

type ServerTags []map[string]interface{}

func (*ServerTags) Scan

func (st *ServerTags) Scan(src interface{}) error

func (ServerTags) Value

func (st ServerTags) Value() (driver.Value, error)

type VIPerson

type VIPerson struct {
	gorm.Model
	RealName string `gorm:"type:varchar(30)"`
	NicName  string `gorm:"type:varchar(30)"`
	Age      int    `gorm:"type:int(3)"`

	OtherInfo *InfoMap `gorm:"type:json"`
}

Jump to

Keyboard shortcuts

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