users

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUser

func CreateUser(ctx context.Context, db *gorm.DB, user *User) error

func UpdateUser

func UpdateUser(ctx context.Context, db *gorm.DB, userID string, updates *User) error

Types

type User

type User struct {
	ID        uuid.UUID `json:"id"         gorm:"column:id;type:uuid;primaryKey"`
	Email     string    `json:"email"      gorm:"column:email;type:varchar(255);unique;not null"`
	FirstName string    `json:"first_name" gorm:"column:first_name;type:varchar(255)"`
	LastName  string    `json:"last_name"  gorm:"column:last_name;type:varchar(255)"`
	Groups    []string  `json:"groups"     gorm:"column:groups;type:jsonb;serializer:json"`
	CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime;column:created_at;not null"`
	UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime;column:updated_at;not null"`
	LastLogin time.Time `json:"last_login" gorm:"column:last_login;type:timestamp"`
}

func GetUserByEmail

func GetUserByEmail(ctx context.Context, db *gorm.DB, email string) (*User, error)

func GetUserByID

func GetUserByID(ctx context.Context, db *gorm.DB, id string) (*User, error)

func (*User) BeforeCreate

func (u *User) BeforeCreate(tx *gorm.DB) error

func (*User) TableName

func (u *User) TableName() string

Jump to

Keyboard shortcuts

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