model

package
v0.0.0-...-29e41e8 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNullString

func NewNullString(s string) sql.NullString

Types

type Member

type Member struct {
	gorm.Model
	SlackUserID   sql.NullString `gorm:"unique;"`
	DiscordUserID sql.NullString `gorm:"unique;"`
	IsStaff       bool           `gorm:"not null;default:false"`
	Profile       Profile        `gorm:"unique;not null;foreignkey:MemberID"`
}

type MemberInfo

type MemberInfo struct {
	ID             uint
	Name           string
	Positions      []string
	TrainingStatus int
	IsStaff        bool
}

func CreateMember

func CreateMember(db *gorm.DB, initMember MemberInit) (bool, MemberInfo, string)

func IdentifyMember

func IdentifyMember(db *gorm.DB, id string) (bool, MemberInfo, string)

type MemberInit

type MemberInit struct {
	Name          string
	SlackUserID   string
	DiscordUserID string
	CreatedFrom   string
}

type Name

type Name struct {
	gorm.Model
	Name string `json:"name"`
}

type Position

type Position struct {
	gorm.Model
	Role        string `gorm:"unique;not null;default:'General Member'"`
	Description string `gorm:"not null;default:'No Description'"`
}

type Profile

type Profile struct {
	gorm.Model
	MemberID       uint
	Name           string     `gorm:"unique;not null"`
	IsVerified     bool       `gorm:"not null;default:false"`
	TrainingStatus int        `gorm:"not null;default:0"`
	Positions      []Position `gorm:"many2many:profile_positions;"`
}

Jump to

Keyboard shortcuts

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