domain

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("resource not found")

ErrNotFound is returned when a resource is not found.

Functions

This section is empty.

Types

type UserModel

type UserModel struct {
	ID               string         `gorm:"type:varchar(36);primaryKey" bson:"_id,omitempty" json:"id"`
	CreatedAt        time.Time      `bson:"created_at,omitempty" json:"created_at"`
	UpdatedAt        time.Time      `bson:"updated_at,omitempty" json:"updated_at"`
	DeletedAt        gorm.DeletedAt `gorm:"index" bson:"-" json:"-"`
	Email            string         `gorm:"type:varchar(255);uniqueIndex;not null" bson:"email" json:"email"`
	HashedPassword   *string        `gorm:"column:hashed_password"                 bson:"hashed_password,omitempty" json:"-"`
	VerificationHash *string        `gorm:"column:hash"                            bson:"hash,omitempty" json:"-"`
	GithubID         *string        `gorm:"column:github_id;unique"                bson:"github_id,omitempty" json:"github_id"`
	LastLoginAt      *time.Time     `                                              bson:"last_login_at,omitempty" json:"last_login_at"`
}

UserModel represents a user entity in the system.

func (*UserModel) BeforeCreate

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

BeforeCreate generates a UUID for the user before creating.

func (UserModel) TableName

func (UserModel) TableName() string

TableName returns the database table name for UserModel.

type UserStore

type UserStore interface {
	Create(ctx context.Context, user *UserModel) error
	GetByID(ctx context.Context, id string) (*UserModel, error)
	GetByEmail(ctx context.Context, email string) (*UserModel, error)
	GetByGithubID(ctx context.Context, githubID string) (*UserModel, error)
	Update(ctx context.Context, user *UserModel) error
	Delete(ctx context.Context, id string) error
	List(ctx context.Context, offset, limit int) ([]*UserModel, error)
	Count(ctx context.Context) (int64, error)
}

UserStore defines the interface for user persistence operations.

Jump to

Keyboard shortcuts

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