gorm

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UserGORM

type UserGORM struct {
	ID              string     `gorm:"type:varchar(26);primaryKey"`
	CreatedAt       time.Time  `gorm:"autoCreateTime"`
	UpdatedAt       time.Time  `gorm:"autoUpdateTime"`
	Username        string     `gorm:"unique;not null;size:150"`
	Email           string     `gorm:"unique;not null;size:254"`
	FirstName       string     `gorm:"size:150"`
	LastName        string     `gorm:"size:150"`
	Password        string     `gorm:"not null;size:128"`
	Height          float64    `gorm:"not null"`
	Weight          float64    `gorm:"not null"`
	OTP             *string    `gorm:"size:6"`
	IsStaff         bool       `gorm:"default:false"`
	IsActive        bool       `gorm:"default:true"`
	IsSuperuser     bool       `gorm:"default:false"`
	IsVerified      bool       `gorm:"default:false"`
	DateJoined      time.Time  `gorm:"autoCreateTime"`
	LastLogin       *time.Time `gorm:"type:timestamp"`
	ProfileImageURL string     `gorm:"size:512"`
}

UserGORM represents the GORM model for User

func UserModelToGORM

func UserModelToGORM(u *userModel.User) *UserGORM

FromUserModel converts domain model to GORM model

func (*UserGORM) BeforeCreate

func (u *UserGORM) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate hook to set ID if not provided

func (UserGORM) TableName

func (UserGORM) TableName() string

func (*UserGORM) ToUserModel

func (u *UserGORM) ToUserModel() *userModel.User

ToUserModel converts GORM model to domain model

Jump to

Keyboard shortcuts

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