models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCandidate

func AddCandidate(candidate Candidate) error

func AddMatchRecord

func AddMatchRecord(record *MatchRecord) error

func CheckAuth

func CheckAuth(username, password string) (bool, error)

func CloseDB

func CloseDB()

func Setup

func Setup()

func UpdateCandidate

func UpdateCandidate(candidate Candidate) error

func UpdateMatchRecord

func UpdateMatchRecord(id int64, gender Gender) error

func WriteDB

func WriteDB() *gorm.DB

获取写库

Types

type Attitude

type Attitude int
const (
	AttitudeUnknown Attitude = 0
	AttitudeAgree   Attitude = 1
	AttitudeUnAgree Attitude = 2
)

type Auth

type Auth struct {
	ID       int    `gorm:"primary_key" json:"id"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type Candidate

type Candidate struct {
	ID         int64           `gorm:"primary_key;column:id" json:"id"`
	Gender     Gender          `gorm:"column:gender" json:"gender"`
	Email      string          `gorm:"column:email" json:"email"`
	Age        int64           `gorm:"column:age" json:"age"`
	Status     CandidateStatus `gorm:"column:status" json:"status"`
	UpdateTime int64           `gorm:"column:update_time" json:"update_time"`
	CreateTime int64           `gorm:"column:create_time" json:"create_time"`
}

func GetCandidateByEmail

func GetCandidateByEmail(email string) (candidate Candidate, err error)

func GetCandidateList

func GetCandidateList(gender Gender) ([]Candidate, error)

type CandidateStatus

type CandidateStatus int
const (
	CandidateStatusOk   CandidateStatus = 1
	CandidateStatusStop CandidateStatus = 2
)

type ConfirmStatus

type ConfirmStatus int
const (
	ConfirmStatusUnknown ConfirmStatus = 0
	ConfirmStatusOk      ConfirmStatus = 1
)

type Gender

type Gender int
const (
	GenderMale   Gender = 1
	GenderFemale Gender = 2
)

type MatchRecord

type MatchRecord struct {
	ID               int64         `gorm:"primary_key;column:id" json:"id"`
	MaleID           int64         `gorm:"column:male_id" json:"male_id"`
	FemaleID         int64         `gorm:"column:female_id" json:"female_id"`
	MaleEmail        string        `gorm:"column:male_email" json:"male_email"`
	FemaleEmail      string        `gorm:"column:female_email" json:"female_email"`
	CreateTime       int64         `gorm:"column:create_time" json:"create_time"`
	MaleSendStatus   SendStatus    `gorm:"column:male_send_status" json:"male_send_status"`
	FemaleSendStatus SendStatus    `gorm:"column:female_send_status" json:"female_send_status"`
	ConfirmStatus    ConfirmStatus `gorm:"column:confirm_status" json:"confirm_status"` // TODO 这里男女生都需要有个确认状态
	MatchResult      Attitude      `gorm:"column:match_result" json:"match_result"`
	MaleAttitude     Attitude      `gorm:"column:male_attitude" json:"male_attitude"`
	FemaleAttitude   Attitude      `gorm:"column:female_attitude" json:"female_attitude"`
	MaleNote         string        `gorm:"column:male_note" json:"male_note"`
	FemaleNote       string        `gorm:"column:female_note" json:"female_note"`
}

func GetMatchRecordList

func GetMatchRecordList() ([]MatchRecord, error)

type Model

type Model struct {
	ID         int `gorm:"primary_key" json:"id"`
	CreatedOn  int `json:"created_on"`
	ModifiedOn int `json:"modified_on"`
	DeletedOn  int `json:"deleted_on"`
}

type SendStatus

type SendStatus int
const (
	SendStatusNo SendStatus = 0
	SendStatusOK SendStatus = 1
)

Jump to

Keyboard shortcuts

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