models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigLog

type ConfigLog struct {
	// the id for the config log entry - auto genrated
	//
	// required: false
	// Unique: true
	// Pattern: [0-9]+
	// min: 1
	ID uint64 `gorm:"primary_key;auto_increment" json:"id"`

	// the service name for the config log entry
	//
	// required: true
	// Unique: false
	// max length: 20
	Service string `gorm:"size:20;not null" json:"service"`

	// the team name for the config log entry
	//
	// required: true
	// Unique: false
	// max length: 20
	Team string `gorm:"size:20;not null" json:"team"`

	// UserInfo []User `json:"user"`
	UserID uint32 `gorm:"not null" json:"user_id"`

	// the message for the config log entry
	//
	// required: true
	// max length: 255
	Message string `gorm:"size:255;not null" json:"message"`

	// the creation date for the config log entry - auto genrated
	//
	// required: false
	// Unique: true
	CreatedAt time.Time `json:"created_on"`

	// the modification date for the config log entry - auto genrated
	//
	// required: false
	// Unique: true
	UpdatedAt time.Time `json:"updated_on"`
}

ConfigLog defines the structure for an API config-log swagger:model

func (*ConfigLog) ConfigLogFieldCheck

func (cl *ConfigLog) ConfigLogFieldCheck()

UserFieldCheck

func (*ConfigLog) ValidateConfigLog

func (cl *ConfigLog) ValidateConfigLog(action string) error

type User

type User struct {
	ID         uint32      `gorm:"primary_key;auto_increment" json:"id"`
	Username   string      `gorm:"size:20;not null;unique" json:"username"`
	Email      string      `gorm:"size:50;not null;unique" json:"email"`
	Password   string      `gorm:"size:60;not null" json:"password"`
	CreatedAt  time.Time   `json:"created_on"`
	UpdatedAt  time.Time   `json:"updated_on"`
	ConfigLogs []ConfigLog `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"config_logs"`
}

User struct abstract of user table in database

func (*User) BeforeSave

func (u *User) BeforeSave(db *gorm.DB) (err error)

BeforeSave method encrypt the password

func (*User) UserFieldCheck

func (u *User) UserFieldCheck()

UserFieldCheck

func (*User) ValidateUser

func (u *User) ValidateUser(action string) error

Jump to

Keyboard shortcuts

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