model

package
v0.0.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleUser  = "user"
	RoleAdmin = "admin"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BannedTokenEntity

type BannedTokenEntity struct {
	ID        int       `gorm:"column:id;type:serial;primaryKey"`
	JTI       string    `gorm:"column:jti;type:text;unique;not null"`
	CreatedAt time.Time `gorm:"column:created_at;not null;type:timestamptz;default:now();autoCreateTime"`
	UpdatedAt time.Time `gorm:"column:updated_at;not null;type:timestamptz;default:now();autoUpdateTime"`
	ExpiredAt int64     `gorm:"column:expired_at;not null;type:bigint;index:expired_at_banned_tokens_index"`
}

func (BannedTokenEntity) TableName

func (BannedTokenEntity) TableName() string

type MasterProfileEntity

type MasterProfileEntity struct {
	UserID      uuid.UUID      `gorm:"column:user_id;type:uuid;primaryKey;"`
	User        UserEntity     `gorm:"foreignkey:UserID;references:ID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	DisplayName string         `gorm:"column:display_name;type:text;not null"`
	Job         string         `gorm:"column:job;type:text;not null"`
	Description *string        `gorm:"column:description;type:text"`
	Point       gormType.Point `gorm:"column:point;type:geography(Point, 4326);not null;index:point_master_profiles_index"`
	Address     *string        `gorm:"column:address;type:text"`
	AvatarID    *string        `gorm:"column:avatar_id;type:text"`
	IsEnabled   bool           `gorm:"column:is_enabled;not null;default:true;index:is_enabled_master_profiles_index"`
	CreatedAt   time.Time      `gorm:"column:created_at;not null;type:timestamptz;default:now();autoCreateTime"`
	UpdatedAt   time.Time      `gorm:"column:updated_at;not null;type:timestamptz;default:now();autoUpdateTime"`
}

func (MasterProfileEntity) TableName

func (MasterProfileEntity) TableName() string

type MasterProfileFilter

type MasterProfileFilter string
const (
	MasterProfileFilterDisplayName MasterProfileFilter = "display_name"
	MasterProfileFilterJob         MasterProfileFilter = "job"
	MasterProfileFilterPoint       MasterProfileFilter = "point"
	MasterProfileFilterAddress     MasterProfileFilter = "address"
)

type MasterProfileFilterPointValue

type MasterProfileFilterPointValue struct {
	Latitude  float64
	Longitude float64
	Radius    float64
}

type Pagination

type Pagination struct {
	Offset int
	Limit  int
}

type RoleEntity

type RoleEntity struct {
	ID          int       `gorm:"column:id;type:serial;primaryKey"`
	Name        string    `gorm:"column:name;type:text;not null;unique"`
	Description *string   `gorm:"column:description;type:text"`
	CreatedAt   time.Time `gorm:"column:created_at;not null;type:timestamptz;default:now();autoCreateTime"`
	UpdatedAt   time.Time `gorm:"column:updated_at;not null;type:timestamptz;default:now();autoUpdateTime"`
}

func (RoleEntity) TableName

func (RoleEntity) TableName() string

type Sort

type Sort struct {
	Field string
	Order SortOrder
}

type SortOrder

type SortOrder string
const (
	SortOrderAsc  SortOrder = "asc"
	SortOrderDesc SortOrder = "desc"
)

type UserEntity

type UserEntity struct {
	ID              uuid.UUID  `gorm:"column:id;type:uuid;primaryKey;default:uuid_generate_v4()"`
	Username        string     `gorm:"column:username;type:varchar(255);not null;unique"`
	Email           string     `gorm:"column:email;type:text;not null;unique"`
	Password        string     `gorm:"column:password;type:text;not null"`
	Role            RoleEntity `gorm:"foreignkey:RoleID;references:id;constraint:OnUpdate:CASCADE,OnDelete:RESTRICT"`
	RoleID          int        `gorm:"column:role_id;not null"`
	IsEnabled       bool       `gorm:"column:is_enabled;not null;default:true;index:is_enabled_users_index"`
	IsEmailVerified bool       `gorm:"column:is_email_verified;not null;default:false;index:is_email_verified_users_index"`
	IsPasswordTemp  bool       `gorm:"column:is_password_temp;not null;default:true;index:is_password_temp_index"`
	CreatedAt       time.Time  `gorm:"column:created_at;not null;type:timestamptz;default:now();autoCreateTime"`
	UpdatedAt       time.Time  `gorm:"column:updated_at;not null;type:timestamptz;default:now();autoUpdateTime"`
	DeletedAt       *time.Time `gorm:"column:deleted_at;type:timestamptz;index:deleted_at_users_index"`
}

func (*UserEntity) BeforeCreate

func (u *UserEntity) BeforeCreate(tx *gorm.DB) error

BeforeCreate sets default role

func (UserEntity) TableName

func (UserEntity) TableName() string

Jump to

Keyboard shortcuts

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