models

package
v0.0.0-...-76fcbe0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2025 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 EducationalStatus

type EducationalStatus string

EducationalStatus enum

const (
	EduHighSchool EducationalStatus = "high_school"
	EduBachelor   EducationalStatus = "bachelor"
	EduMaster     EducationalStatus = "master"
	EduPhD        EducationalStatus = "phd"
	EduDiploma    EducationalStatus = "diploma"
	EduNone       EducationalStatus = "none"
)

func (EducationalStatus) IsValid

func (e EducationalStatus) IsValid() bool

func (*EducationalStatus) Scan

func (e *EducationalStatus) Scan(value interface{}) error

func (EducationalStatus) Value

func (e EducationalStatus) Value() (driver.Value, error)

type Gender

type Gender string

Gender enum

const (
	GenderMale      Gender = "male"
	GenderFemale    Gender = "female"
	GenderNonBinary Gender = "nonbinary"
)

func (Gender) IsValid

func (g Gender) IsValid() bool

func (*Gender) Scan

func (g *Gender) Scan(value interface{}) error

func (Gender) Value

func (g Gender) Value() (driver.Value, error)

type Interest

type Interest string

Interest enum

const (
	InterestSports     Interest = "sports"
	InterestTechnology Interest = "technology"
	InterestArts       Interest = "arts"
	InterestMusic      Interest = "music"
	InterestMovies     Interest = "movies"
	InterestBooks      Interest = "books"
	InterestTravel     Interest = "travel"
	InterestCooking    Interest = "cooking"
	InterestGaming     Interest = "gaming"
	InterestNature     Interest = "nature"
)

type Interests

type Interests []Interest

func (*Interests) Scan

func (i *Interests) Scan(value interface{}) error

func (Interests) Value

func (i Interests) Value() (driver.Value, error)

type MaritalStatus

type MaritalStatus string

MaritalStatus enum

const (
	MaritalSingle   MaritalStatus = "single"
	MaritalMarried  MaritalStatus = "married"
	MaritalDivorced MaritalStatus = "divorced"
	MaritalWidowed  MaritalStatus = "widowed"
)

func (MaritalStatus) IsValid

func (m MaritalStatus) IsValid() bool

func (*MaritalStatus) Scan

func (m *MaritalStatus) Scan(value interface{}) error

func (MaritalStatus) Value

func (m MaritalStatus) Value() (driver.Value, error)

type Skill

type Skill string

Skill enum

const (
	SkillProgramming Skill = "programming"
	SkillDesign      Skill = "design"
	SkillWriting     Skill = "writing"
	SkillMarketing   Skill = "marketing"
	SkillManagement  Skill = "management"
	SkillTeaching    Skill = "teaching"
	SkillCooking     Skill = "cooking"
	SkillPhotography Skill = "photography"
	SkillMusic       Skill = "music"
	SkillLanguages   Skill = "languages"
)

type Skills

type Skills []Skill

func (*Skills) Scan

func (s *Skills) Scan(value interface{}) error

func (Skills) Value

func (s Skills) Value() (driver.Value, error)

type User

type User struct {
	ID                uint              `gorm:"primaryKey" json:"id"`
	BirthDate         *time.Time        `gorm:"type:date" json:"birthDate"`
	Email             string            `gorm:"varchar(150);not null" json:"email"`
	FullName          string            `gorm:"varchar(150)" json:"fullName"`
	Gender            Gender            `gorm:"varchar(20);check:gender IN ('male','female','non-binary')" json:"gender"`
	MaritalStatus     MaritalStatus     `gorm:"varchar(20);check:marital_status IN ('single','married','divorced','widowed')" json:"maritalStatus"`
	EducationalStatus EducationalStatus `` /* 130-byte string literal not displayed */
	ProfilePic        string            `gorm:"varchar(255)" json:"profilePic"`
	Height            float64           `gorm:"type:decimal(5,2)" json:"height"` // in cm
	Weight            float64           `gorm:"type:decimal(5,2)" json:"weight"` // in kg
	BornPlace         string            `gorm:"varchar(100)" json:"bornPlace"`
	LivePlace         string            `gorm:"varchar(100)" json:"livePlace"`
	HasPet            bool              `gorm:"default:false" json:"hasPet"`
	DoesExercise      bool              `gorm:"default:false" json:"doesExercise"`
	Skills            Skills            `gorm:"type:json" json:"skills"`
	Interests         Interests         `gorm:"type:json" json:"interests"`
	Details           string            `gorm:"varchar(250)" json:"details"`
	CreatedAt         time.Time         `json:"createdAt"`
	UpdatedAt         time.Time         `json:"updatedAt"`
}

func (*User) BeforeSave

func (u *User) BeforeSave(tx *gorm.DB) error

BeforeSave validates enum fields before saving

Jump to

Keyboard shortcuts

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