entity

package
v0.0.0-...-49a09ed Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemoryUserRepository

type InMemoryUserRepository struct {
	// contains filtered or unexported fields
}

func NewInMemoryUserRepository

func NewInMemoryUserRepository() *InMemoryUserRepository

func (*InMemoryUserRepository) DeleteByID

func (r *InMemoryUserRepository) DeleteByID(id string) error

func (*InMemoryUserRepository) FindAll

func (r *InMemoryUserRepository) FindAll() ([]*User, error)

type PromotionRepository

type PromotionRepository interface {
	GetAvailableUsers(promoType int) ([]int, error)
	GetAppliedUsers(promoID uint) ([]int, error)
	ApplyPromotion(promoID uint, userIDs []int) error
}

type User

type User struct {
	ID    uint
	Name  string
	Email string
}

func NewUser

func NewUser(name, email string) *User

func (*User) Update

func (d *User) Update(name, email string)

type UserPromotion

type UserPromotion struct {
	ID          uint `json:"id"`
	UserID      uint `json:"user_id"`
	PromotionID uint `json:"promotion_id"`
	Type        int  `json:"type"`
}

type UserRepository

type UserRepository interface {
	Create(user *User) error
	FindAll() ([]*User, error)
	Update(user *User) error
	DeleteByID(id uint) error
	GetByID(id uint) (*User, error)
}

Jump to

Keyboard shortcuts

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