models

package
v0.0.0-...-6b8d177 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(password string) ([]byte, error)

func VerifyPassword

func VerifyPassword(hashedPassword, password string) error

Types

type Base

type Base struct {
	ID        uuid.UUID `gorm:"primary_key;type:uuid;" json:"id"`
	CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
}

func (*Base) BeforeCreate

func (base *Base) BeforeCreate(scope *gorm.Scope) error

type CustomSchema

type CustomSchema struct {
	Base
	Name        string         `gorm:"size:255;not null" json:"name"`
	Title       string         `gorm:"size:255;" json:"title"`
	Description string         `gorm:"size:255;" json:"description"`
	FieldNames  pq.StringArray `gorm:"type:text[];not null" json:"field_names"`
	Data        pgtype.JSONB   `gorm:"type:jsonb;default:'[]';not null" json:"data"`
	User        User           `json:"-"`
	UserID      uuid.UUID      `gorm:"not null;type:uuid;" json:"user_id"`
	UpdatedAt   time.Time      `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
}

func (*CustomSchema) DeleteACustomSchema

func (p *CustomSchema) DeleteACustomSchema(db *gorm.DB, pid uuid.UUID, uid uuid.UUID) (int64, error)

func (*CustomSchema) FindAllCustomSchemas

func (p *CustomSchema) FindAllCustomSchemas(db *gorm.DB) (*[]CustomSchema, error)

func (*CustomSchema) FindAllMyCustomSchemas

func (p *CustomSchema) FindAllMyCustomSchemas(db *gorm.DB, uid uuid.UUID) (*[]CustomSchema, error)

func (*CustomSchema) FindCustomSchemaByID

func (p *CustomSchema) FindCustomSchemaByID(db *gorm.DB, pid uuid.UUID) (*CustomSchema, error)

func (*CustomSchema) GoFindAllMyCustomSchemas

func (p *CustomSchema) GoFindAllMyCustomSchemas(db *gorm.DB, uid uuid.UUID) (*[]CustomSchemaResponse, error)

func (*CustomSchema) GoFindCustomSchemaByID

func (p *CustomSchema) GoFindCustomSchemaByID(db *gorm.DB, pid uuid.UUID, uid uuid.UUID) (*CustomSchema, error)

func (*CustomSchema) Prepare

func (p *CustomSchema) Prepare()

func (*CustomSchema) SaveCustomSchema

func (p *CustomSchema) SaveCustomSchema(db *gorm.DB) (*CustomSchema, error)

func (*CustomSchema) UpdateACustomSchema

func (p *CustomSchema) UpdateACustomSchema(db *gorm.DB) (*CustomSchema, error)

func (*CustomSchema) Validate

func (p *CustomSchema) Validate() error

type CustomSchemaResponse

type CustomSchemaResponse struct {
	ID          uuid.UUID    `gorm:"primary_key;type:uuid;" json:"id"`
	Name        string       `gorm:"size:255;not null" json:"name"`
	Title       string       `gorm:"size:255;" json:"title"`
	Description string       `gorm:"size:255;" json:"description"`
	Data        pgtype.JSONB `gorm:"type:jsonb;default:'[]';not null" json:"data"`
	User        User         `json:"-"`
	UserID      uuid.UUID    `gorm:"not null;type:uuid;" json:"user_id"`
}

type User

type User struct {
	Base
	Name        string    `gorm:"size:255;not null" json:"name"`
	Age         string    `gorm:"size:255;" json:"age"`
	Moto        string    `gorm:"size:255;" json:"moto"`
	AboutYou    string    `gorm:"size:255;" json:"about_you"`
	WhatDoYouDo string    `gorm:"size:255;" json:"what_do_you_do"`
	PhoneNumber string    `gorm:"size:255;" json:"phone_number"`
	ProfileImg  string    `gorm:"size:255;" json:"profile_img"`
	ProfileIcon string    `gorm:"size:255;" json:"profile_icon"`
	Email       string    `gorm:"size:255;not null;unique" json:"email"`
	Password    string    `gorm:"size:255;not null;" json:"password"`
	UpdatedAt   time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
}

func (*User) BeforeSave

func (u *User) BeforeSave() error

func (*User) DeleteAUser

func (u *User) DeleteAUser(db *gorm.DB, uid uuid.UUID) (int64, error)

func (*User) FindAllUsers

func (u *User) FindAllUsers(db *gorm.DB) (*[]User, error)

func (*User) FindUserByID

func (u *User) FindUserByID(db *gorm.DB, uid uuid.UUID) (*User, error)

func (*User) Prepare

func (u *User) Prepare()

func (*User) SaveUser

func (u *User) SaveUser(db *gorm.DB) (*User, error)

func (*User) UpdateAUser

func (u *User) UpdateAUser(db *gorm.DB, uid uuid.UUID) (*User, error)

func (*User) Validate

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

Jump to

Keyboard shortcuts

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