Documentation
¶
Index ¶
- func Hash(password string) ([]byte, error)
- func VerifyPassword(hashedPassword, password string) error
- type Product
- func (p *Product) DeleteAProduct(db *gorm.DB, pid uuid.UUID, oid uuid.UUID) (int64, error)
- func (p *Product) FindAllOpenProducts(db *gorm.DB) (*[]Product, error)
- func (p *Product) FindAllProducts(db *gorm.DB, oid uuid.UUID) (*[]Product, error)
- func (p *Product) FindProductByID(db *gorm.DB, pid uuid.UUID, oid uuid.UUID) (*Product, error)
- func (p *Product) Prepare()
- func (p *Product) SaveProduct(db *gorm.DB) (*Product, error)
- func (p *Product) UpdateAProduct(db *gorm.DB, pid uuid.UUID) (*Product, error)
- func (p *Product) Validate(action string) error
- type ResponseProduct
- type ResponseUser
- type User
- func (u *User) BeforeSave() error
- func (u *User) DeleteAUser(db *gorm.DB, uid uuid.UUID) (int64, error)
- func (u *User) FindAllUsers(db *gorm.DB) (*[]User, error)
- func (u *User) FindUserByID(db *gorm.DB, uid uuid.UUID) (*User, error)
- func (u *User) Prepare()
- func (u *User) SaveUser(db *gorm.DB) (*User, error)
- func (u *User) UpdateAUser(db *gorm.DB, uid uuid.UUID) (*User, error)
- func (u *User) Validate(action string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VerifyPassword ¶
Types ¶
type Product ¶
type Product struct { ID uuid.UUID `gorm:"primary_key;auto_increment" json:"id"` Name string `gorm:"size:255;not null" json:"name"` Brand string `gorm:"size:255;not null" json:"brand"` Image string `gorm:"size:2000;null" json:"image"` Size string `gorm:"size:200;null" json:"size"` Model string `gorm:"size:255;null" json:"model"` Price float64 `gorm:"default:0.00;null" json:"price"` OwnerID uuid.UUID `gorm:"not null" json:"owner_id"` ExpDate time.Time `gorm:"null" json:"exp_date"` Description string `gorm:"size:2000;null" json:"description"` CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"` UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"` }
Product struct for Product
func (*Product) DeleteAProduct ¶
DeleteAProduct delete Product by id
func (*Product) FindAllOpenProducts ¶
FindAllOpenProducts get all Products
func (*Product) FindAllProducts ¶
FindAllProducts get all Products
func (*Product) FindProductByID ¶
FindProductByID fin Product by id
func (*Product) SaveProduct ¶
SaveProduct save Product
func (*Product) UpdateAProduct ¶
UpdateAProduct update Product
type ResponseProduct ¶
type ResponseProduct struct { ID uuid.UUID Name string Brand string Image string Size string Model string Price float64 ExpDate time.Time OwnerID uuid.UUID Description string CreatedAt time.Time UpdatedAt time.Time }
ResponseProduct return for the struct Product
func SanitizeProduct ¶
func SanitizeProduct(p Product) ResponseProduct
SanitizeProduct the Product response
type ResponseUser ¶
type ResponseUser struct { ID uuid.UUID Fullname string Nickname string Email string CreatedAt time.Time UpdatedAt time.Time }
ResponseUser return for the struct Product
type User ¶
type User struct { ID uuid.UUID `gorm:"primary_key;auto_increment" json:"id"` Fullname string `gorm:"size:255;not null;unique" json:"fullname"` Nickname string `gorm:"size:255;not null;unique" json:"nickname"` Email string `gorm:"size:100;not null;unique" json:"email"` Password string `gorm:"size:100;not null;" json:"password"` CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"` UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"` }
func (*User) BeforeSave ¶
Click to show internal directories.
Click to hide internal directories.