model

package
v1.14.3 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package model contains the data models used in the application.

Index

Constants

This section is empty.

Variables

View Source
var UserExampleColumnNames = map[string]bool{
	"id":         true,
	"created_at": true,
	"updated_at": true,
	"deleted_at": true,
	"name":       true,
	"password":   true,
	"email":      true,
	"phone":      true,
	"avatar":     true,
	"age":        true,
	"gender":     true,
	"status":     true,
	"login_at":   true,
}

UserExampleColumnNames Whitelist for custom query fields to prevent sql injection attacks

Functions

This section is empty.

Types

type UserExample

type UserExample struct {
	sgorm.Model `gorm:"embedded"`

	Name     string `gorm:"column:name;NOT NULL" json:"name"`         // username
	Password string `gorm:"column:password;NOT NULL" json:"password"` // password
	Email    string `gorm:"column:email;NOT NULL" json:"email"`       // email
	Phone    string `gorm:"column:phone;NOT NULL" json:"phone"`       // phone number
	Avatar   string `gorm:"column:avatar;NOT NULL" json:"avatar"`     // avatar
	Age      int    `gorm:"column:age;NOT NULL" json:"age"`           // age
	Gender   int    `gorm:"column:gender;NOT NULL" json:"gender"`     // gender, 1:Male, 2:Female, other values:unknown
	Status   int    `gorm:"column:status;NOT NULL" json:"status"`     // account status, 1:inactive, 2:activated, 3:blocked
	LoginAt  int64  `gorm:"column:login_at;NOT NULL" json:"loginAt"`  // login timestamp
}

UserExample object fields mapping table

func (*UserExample) TableName

func (table *UserExample) TableName() string

TableName get table name

Jump to

Keyboard shortcuts

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