entity

package
v0.0.0-...-ed8586a Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const AuthUserIDKey = authUserIDKey("user_id")

AuthUserIDKey is the key for the user_id value in the context.

View Source
const (
	MinPasswordLength = 6
)

Variables

View Source
var (
	ErrEmailInvalid     = errors.New("user.entity.email_invalid")
	ErrPasswordTooShort = errors.New("user.entity.password_too_short")
)

User entity errors.

View Source
var (
	ErrAuthTokenExpired = errors.New("auth.entity.token.expired")
)

Auth entity errors.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	ID        AuthID
	UserID    UserID
	Token     string
	ExpiresAt time.Time
}

Auth represents an authentication in the system.

func (*Auth) VerifyTokenExpires

func (a *Auth) VerifyTokenExpires() error

VerifyTokenExpires checks if the token has expired.

type AuthID

type AuthID string

type NullTime

type NullTime struct {
	sql.NullTime
}

NullTime that may be null. NullTime embed sql.NullTime and implement json Unmarshaler and Marshaler

func (NullTime) MarshalJSON

func (t NullTime) MarshalJSON() ([]byte, error)

func (*NullTime) UnmarshalJSON

func (t *NullTime) UnmarshalJSON(data []byte) error

type Task

type Task struct {
	ID          TaskID
	UserID      UserID
	Content     string
	Description string
	IsCompleted bool
	DueDate     NullTime
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

Task represents a task in the system.

type TaskID

type TaskID string

type User

type User struct {
	ID        UserID
	Name      string
	Email     string
	Password  string
	CreatedAt time.Time
	UpdatedAt time.Time
}

User represents a user in the system.

func (*User) Validate

func (u *User) Validate() error

Validate user fields.

type UserID

type UserID string

func GetAuthContext

func GetAuthContext(ctx context.Context) UserID

GetAuthContext get the AuthUserIDKey from the context.

Jump to

Keyboard shortcuts

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