entity

package
v0.0.0-...-db2bfc3 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Domain entities

Index

Constants

View Source
const (
	StatusNew        = "NEW"
	StatusRegistered = "REGISTERED"
	StatusProcessed  = "PROCESSED"
	StatusInvalid    = "INVALID"
	StatusProcessing = "PROCESSING"
)

order status

Variables

View Source
var (
	ErrEnvVarNotFound                  = errors.New("env var not set")
	ErrMethodNotAllowed                = errors.New("method not allowed")
	ErrUnsupportedMediaType            = errors.New("unsupported media type")
	ErrInternalServerError             = errors.New("internal server error")
	ErrStatusBadRequest                = errors.New("bad request")
	ErrUserLoginNotUnique              = errors.New("login not unique")
	ErrUserLoginUnauthorized           = errors.New("user unauthorized")
	ErrUnprocessableEntity             = errors.New("unprocessable entity")
	ErrOrderAlreadyUploadedAnotherUser = errors.New("order already uploaded another user")
	ErrOrderAlreadyUploaded            = errors.New("order already uploaded")
	ErrNoContent                       = errors.New("no content")
	ErrInsufficientBalance             = errors.New("insufficient balance")
)

define errors

Functions

This section is empty.

Types

type Balance

type Balance struct {
	Current   float64 `json:"current"`
	Withdrawn float64 `json:"withdrawn"`
}

struct for user Balance

type BalanceUpdate

type BalanceUpdate struct {
	Order      string    `json:"order"`
	Sum        float64   `json:"sum"`
	UploadedAt time.Time `json:"processed_at,omitempty"`
}

struct for update user Balance

func (*BalanceUpdate) IsValidNumber

func (b *BalanceUpdate) IsValidNumber() error

Luhn algorithm

type Order

type Order struct {
	Number     string    `json:"number"`
	Status     string    `json:"Status"`
	Accrual    float64   `json:"accrual,omitempty"`
	UploadedAt time.Time `json:"uploaded_at"`
	Sum        float64   `json:"sum,omitempty"`
}

struct for user Order

func (*Order) IsValidNumber

func (o *Order) IsValidNumber() error

Luhn algorithm

type User

type User struct {
	Login     string `json:"login" binding:"required"`
	Password  string `json:"password" binding:"required"`
	ID        int64
	IP        string
	UserAgent string
}

struct for User

Jump to

Keyboard shortcuts

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