model

package
v0.0.0-...-d32eb86 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLimit = 1000

Variables

This section is empty.

Functions

func UserToProto

func UserToProto(u *User) *pb.User

ToProto converts User model to protobuf message

Types

type CreateOptions

type CreateOptions struct {
	DryRun []string `json:"dryRun,omitempty"`
}

type DeleteOptions

type DeleteOptions struct {
	Unscoped bool `json:"unscoped"`
}

type Extend

type Extend map[string]interface{}

func (Extend) Merge

func (ext Extend) Merge(extendShadow string) Extend

func (Extend) String

func (ext Extend) String() string

type GetOptions

type GetOptions struct {
}

type LimitAndOffset

type LimitAndOffset struct {
	Offset int
	Limit  int
}

func Unpointer

func Unpointer(offset *int64, limit *int64) *LimitAndOffset

type ListMeta

type ListMeta struct {
	TotalCount int64 `json:"totalCount,omitempty"`
}

type ListOptions

type ListOptions struct {
	LabelSelector string `json:"labelSelector,omitempty" form:"labelSelector"`

	FieldSelector string `json:"fieldSelector,omitempty" form:"fieldSelector"`

	TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty"`

	Offset *int64 `json:"offset,omitempty" form:"offset"`

	Limit *int64 `json:"limit,omitempty" form:"limit"`
}

type ObjectMeta

type ObjectMeta struct {
	ID uint64 `json:"id,omitempty" gorm:"primary_key;AUTO_INCREMENT;column:id"`

	Extend Extend `json:"extend,omitempty" gorm:"-" validate:"omitempty"`

	ExtendShadow string `json:"-" gorm:"column:extendShadow" validate:"omitempty"`

	CreatedAt time.Time `json:"createdAt,omitempty" gorm:"column:created_at"`

	UpdatedAt time.Time `json:"updatedAt,omitempty" gorm:"column:updated_at"`

	DeletedAt gorm.DeletedAt `json:"-" gorm:"column:deleted_at;index:idx_deleted_at"`

	Status int `json:"status,omitempty" gorm:"column:status;default:0"`
}

func (*ObjectMeta) AfterFind

func (obj *ObjectMeta) AfterFind(tx *gorm.DB) error

func (*ObjectMeta) BeforeCreate

func (obj *ObjectMeta) BeforeCreate(tx *gorm.DB) error

func (*ObjectMeta) BeforeUpdate

func (obj *ObjectMeta) BeforeUpdate(tx *gorm.DB) error

type PatchOptions

type PatchOptions struct {
	DryRun []string `json:"dryRun,omitempty"`

	Force bool `json:"force,omitempty"`
}

type TableOptions

type TableOptions struct {
	NoHeaders bool `json:"-"`
}

type UpdateOptions

type UpdateOptions struct {
	DryRun []string `json:"dryRun,omitempty"`
}

type User

type User struct {
	ObjectMeta
	Name string `json:"name,omitempty" gorm:"column:name;type:varchar(255);not null" validate:"required"`
	// Required: true
	Email           string    `json:"email" gorm:"column:email" validate:"required,email,min=1,max=100"`
	EmailVerifiedAt time.Time `gorm:"column:email_verified_at" json:"-"`
	Password        string    `json:"-" gorm:"column:password" validate:"required"`
	RememberToken   string    `gorm:"size:100" json:"-"`
	StripeID        string    `gorm:"size:255" json:"stripeId"`
	DiscordID       uint64    `gorm:"default:0" json:"discordId"`
	PMType          string    `gorm:"size:255" json:"-"`
	PMLastFour      string    `gorm:"size:4" json:"-"`
	TrialEndsAt     time.Time `gorm:"column:trial_ends_at" json:"-"`
	TotalCredits    int       `gorm:"default:0" json:"totalCredits"`
	Token           string    `json:"token,omitempty" gorm:"-"`
}

func ProtoToUser

func ProtoToUser(pbUser *pb.User) (*User, error)

func (*User) Compare

func (u *User) Compare(pwd string) error

func (User) TableName

func (User) TableName() string

TableName overrides the table name used by User to `users`.

type UserList

type UserList struct {

	// Standard list metadata.
	// +optional
	ListMeta `json:",inline"`

	Items []*User `json:"items"`
}

UserList is the whole list of all users which have been stored in stroage.

Jump to

Keyboard shortcuts

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