model

package
v0.0.0-...-a448e87 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("user not found")
)

Functions

This section is empty.

Types

type Conversation

type Conversation struct {
	ID        int       `gorm:"type:int(11);primary_key;auto_increment;not null"`
	Title     string    `gorm:"type:nvarchar(50);not null"`
	Creator   int       `gorm:"type:int(11);not null"`
	CreatedAt time.Time `gorm:"type:datetime;not null"`
}

type Hobby

type Hobby struct {
	ID    int    `gorm:"type:int;auto_increment;primary_key"`
	Hobby string `gorm:"type:nvarchar(255);not null;unique"`
}

type LikeAndDislike

type LikeAndDislike struct {
	UserId1 int `gorm:"type:int(11);column:user_id1;primary_key"`
	UserId2 int `gorm:"type:int(11);column:user_id2;primary_key"`
	Status  int `gorm:"type:int(11)"`
}

type Message

type Message struct {
	ID             int       `gorm:"type:int;primary_key;AUTO_INCREMENT" json:"id"`
	ConversationId int       `gorm:"type:int(11);not null" json:"conversation_id"`
	SenderId       int       `gorm:"type:int(11);not null" json:"sender_id"`
	Type           int       `gorm:"type:int(11);default:1" json:"type"` // 1_text, 2_image
	Message        string    `gorm:"type:nvarchar(255);not null" json:"message"`
	SentOn         time.Time `gorm:"type:timestamp;not null" json:"sent_on"`
}

type MockHobby

type MockHobby struct {
	gorm.Model
	Hobby string `gorm:"type:nvarchar(255);not null;unique"`
}

type Participant

type Participant struct {
	ConversationId int `gorm:"type:int(11);primary_key;not null"`
	UserId         int `gorm:"type:int(11);primary_key;not null"`
	Type           int `gorm:"type:int(11);not null;default:1"` //type: 1_couple, 2_group
}

type User

type User struct {
	// gorm.Model
	ID               int        `gorm:"primary_key;auto_increment" json:"id,omitempty"`
	Username         string     `form:"username" binding:"required" gorm:"column:username;type:varchar(50);unique;not null" json:"username,omitempty"`
	Password         string     `form:"password" binding:"required" gorm:"column:password;type:varchar(255);not null;" json:"password,omitempty"`
	Name             string     `form:"name" binding:"required" gorm:"column:name;type:nvarchar(50);not null" json:"name,omitempty"`
	DateOfBirth      *time.Time `` /* 145-byte string literal not displayed */
	PhoneNumber      string     `form:"phone" binding:"required" gorm:"column:phone_number;type:varchar(12);not null" json:"phone_number,omitempty"`
	Sex              bool       `form:"sex" gorm:"column:sex;type:bool;not null" json:"sex,omitempty"`
	Email            string     `form:"email" binding:"required" gorm:"column:email;type:varchar(60);not mull;unique" json:"email,omitempty"`
	SexOfInterest    bool       `form:"soi" gorm:"column:sex_of_interest;type:bool;not null" json:"sex_of_interest,omitempty"`
	Job              string     `form:"job" gorm:"column:job;type:nvarchar(30)" json:"job,omitempty"`
	Degree           string     `form:"degree" gorm:"column:degree;type:nvarchar(30)" json:"degree,omitempty"`
	MinAgeOfInterest int        `` /* 126-byte string literal not displayed */
	MaxAgeOfInterest int        `` /* 126-byte string literal not displayed */
	Latitude         float64    `form:"latitude" gorm:"column:latitude;type:float(10,6)" json:"latitude,omitempty"`
	Longitude        float64    `form:"longitude" gorm:"column:longitude;type:float(10,6)" json:"longitude,omitempty"`
	AvatarImg        string     `form:"ava_img" gorm:"column:avatar_img;type:varchar(255)" json:"avatar_img,omitempty"`
	SecretKey        string     `gorm:"column:secret_key;type:varchar(36);default:'more than code'" json:"secret_key,omitempty"`
	LastSeen         *time.Time `gorm:"column:last_seen;type:datetime" json:"last_seen,omitempty"`
}

type UserHobby

type UserHobby struct {
	UserId  int `gorm:"type:int(11)"`
	HobbyId int `gorm:"type:int(11)"`
}

func (UserHobby) TableName

func (UserHobby) TableName() string

type UserImg

type UserImg struct {
	ImgId   int    `gorm:"type:int(11);primary_key;auto_increment"`
	UserId  int    `gorm:"type:int(11)"`
	ImgData string `gorm:"type:varchar(255)"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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