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 ¶
BeforeCreate generates a UUID for the user before creating.
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.
Click to show internal directories.
Click to hide internal directories.