models

package
v0.0.0-...-1a43062 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID      uint `gorm:"primaryKey"`
	UserID  uint
	Balance sql.NullFloat64
}

type Order

type Order struct {
	ID         uint    `gorm:"primaryKey" json:"-"`
	UserID     uint    `json:"-"`
	Number     string  `gorm:"uniqueIndex:idx_numbers,sort:desc" json:"number"`
	Status     string  `json:"status"`
	Accrual    float64 `json:"accrual,omitempty"`
	UploadedAt int64   `gorm:"autoCreateTime" json:"uploaded_at"`
}

type OrderLog

type OrderLog struct {
	ID          uint    `gorm:"primaryKey" json:"-"`
	UserID      uint    `json:"-"`
	OrderNumber string  `json:"order"`
	Sum         float64 `json:"sum"`
	ProcessedAt int64   `gorm:"autoCreateTime" json:"processed_at"`
}

type User

type User struct {
	ID        uint       `gorm:"primaryKey" json:"-"`
	Login     string     `gorm:"uniqueIndex:idx_logins" json:"login"`
	Password  string     `json:"password,omitempty"`
	Account   Account    `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" json:"-"`
	Orders    []Order    `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" json:"-"`
	OrderLogs []OrderLog `json:"-"`
}

Jump to

Keyboard shortcuts

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