stage 0 database schema ready

This commit is contained in:
portakal 2026-05-25 20:07:14 +03:00
commit 7720522a32
18 changed files with 5577 additions and 4 deletions

704
backend/db/models.go Normal file
View file

@ -0,0 +1,704 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
package db
import (
"database/sql"
"database/sql/driver"
"fmt"
"time"
)
type BuildingsBuildingType string
const (
BuildingsBuildingTypeNone BuildingsBuildingType = "none"
BuildingsBuildingTypeStorage BuildingsBuildingType = "storage"
BuildingsBuildingTypeSupport BuildingsBuildingType = "support"
BuildingsBuildingTypeOperation BuildingsBuildingType = "operation"
BuildingsBuildingTypePassive BuildingsBuildingType = "passive"
BuildingsBuildingTypeShop BuildingsBuildingType = "shop"
BuildingsBuildingTypeProduction BuildingsBuildingType = "production"
)
func (e *BuildingsBuildingType) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = BuildingsBuildingType(s)
case string:
*e = BuildingsBuildingType(s)
default:
return fmt.Errorf("unsupported scan type for BuildingsBuildingType: %T", src)
}
return nil
}
type NullBuildingsBuildingType struct {
BuildingsBuildingType BuildingsBuildingType
Valid bool // Valid is true if BuildingsBuildingType is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullBuildingsBuildingType) Scan(value interface{}) error {
if value == nil {
ns.BuildingsBuildingType, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.BuildingsBuildingType.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullBuildingsBuildingType) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.BuildingsBuildingType), nil
}
type BuildingsOperationSize string
const (
BuildingsOperationSizeSmall BuildingsOperationSize = "small"
BuildingsOperationSizeMedium BuildingsOperationSize = "medium"
BuildingsOperationSizeLarge BuildingsOperationSize = "large"
BuildingsOperationSizeHuge BuildingsOperationSize = "huge"
)
func (e *BuildingsOperationSize) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = BuildingsOperationSize(s)
case string:
*e = BuildingsOperationSize(s)
default:
return fmt.Errorf("unsupported scan type for BuildingsOperationSize: %T", src)
}
return nil
}
type NullBuildingsOperationSize struct {
BuildingsOperationSize BuildingsOperationSize
Valid bool // Valid is true if BuildingsOperationSize is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullBuildingsOperationSize) Scan(value interface{}) error {
if value == nil {
ns.BuildingsOperationSize, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.BuildingsOperationSize.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullBuildingsOperationSize) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.BuildingsOperationSize), nil
}
type BuildingsOperationType string
const (
BuildingsOperationTypeRunway BuildingsOperationType = "runway"
BuildingsOperationTypeService BuildingsOperationType = "service"
BuildingsOperationTypeProduction BuildingsOperationType = "production"
)
func (e *BuildingsOperationType) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = BuildingsOperationType(s)
case string:
*e = BuildingsOperationType(s)
default:
return fmt.Errorf("unsupported scan type for BuildingsOperationType: %T", src)
}
return nil
}
type NullBuildingsOperationType struct {
BuildingsOperationType BuildingsOperationType
Valid bool // Valid is true if BuildingsOperationType is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullBuildingsOperationType) Scan(value interface{}) error {
if value == nil {
ns.BuildingsOperationType, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.BuildingsOperationType.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullBuildingsOperationType) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.BuildingsOperationType), nil
}
type BuildingsPassiveType string
const (
BuildingsPassiveTypePassengers BuildingsPassiveType = "passengers"
BuildingsPassiveTypeFuel BuildingsPassiveType = "fuel"
)
func (e *BuildingsPassiveType) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = BuildingsPassiveType(s)
case string:
*e = BuildingsPassiveType(s)
default:
return fmt.Errorf("unsupported scan type for BuildingsPassiveType: %T", src)
}
return nil
}
type NullBuildingsPassiveType struct {
BuildingsPassiveType BuildingsPassiveType
Valid bool // Valid is true if BuildingsPassiveType is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullBuildingsPassiveType) Scan(value interface{}) error {
if value == nil {
ns.BuildingsPassiveType, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.BuildingsPassiveType.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullBuildingsPassiveType) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.BuildingsPassiveType), nil
}
type BuildingsStorageSubtype string
const (
BuildingsStorageSubtypeNone BuildingsStorageSubtype = "none"
BuildingsStorageSubtypeAirplane BuildingsStorageSubtype = "airplane"
BuildingsStorageSubtypeHelicopter BuildingsStorageSubtype = "helicopter"
BuildingsStorageSubtypeSeaplane BuildingsStorageSubtype = "seaplane"
BuildingsStorageSubtypeSpaceship BuildingsStorageSubtype = "spaceship"
)
func (e *BuildingsStorageSubtype) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = BuildingsStorageSubtype(s)
case string:
*e = BuildingsStorageSubtype(s)
default:
return fmt.Errorf("unsupported scan type for BuildingsStorageSubtype: %T", src)
}
return nil
}
type NullBuildingsStorageSubtype struct {
BuildingsStorageSubtype BuildingsStorageSubtype
Valid bool // Valid is true if BuildingsStorageSubtype is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullBuildingsStorageSubtype) Scan(value interface{}) error {
if value == nil {
ns.BuildingsStorageSubtype, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.BuildingsStorageSubtype.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullBuildingsStorageSubtype) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.BuildingsStorageSubtype), nil
}
type BuildingsStorageType string
const (
BuildingsStorageTypeFuel BuildingsStorageType = "fuel"
BuildingsStorageTypePlane BuildingsStorageType = "plane"
BuildingsStorageTypeProduct BuildingsStorageType = "product"
)
func (e *BuildingsStorageType) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = BuildingsStorageType(s)
case string:
*e = BuildingsStorageType(s)
default:
return fmt.Errorf("unsupported scan type for BuildingsStorageType: %T", src)
}
return nil
}
type NullBuildingsStorageType struct {
BuildingsStorageType BuildingsStorageType
Valid bool // Valid is true if BuildingsStorageType is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullBuildingsStorageType) Scan(value interface{}) error {
if value == nil {
ns.BuildingsStorageType, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.BuildingsStorageType.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullBuildingsStorageType) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.BuildingsStorageType), nil
}
type CountriesContinent string
const (
CountriesContinentVoid CountriesContinent = "void"
CountriesContinentAfrica CountriesContinent = "Africa"
CountriesContinentAntarctica CountriesContinent = "Antarctica"
CountriesContinentAsia CountriesContinent = "Asia"
CountriesContinentEurope CountriesContinent = "Europe"
CountriesContinentNorthAmerica CountriesContinent = "North America"
CountriesContinentOceania CountriesContinent = "Oceania"
CountriesContinentSouthAmerica CountriesContinent = "South America"
)
func (e *CountriesContinent) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = CountriesContinent(s)
case string:
*e = CountriesContinent(s)
default:
return fmt.Errorf("unsupported scan type for CountriesContinent: %T", src)
}
return nil
}
type NullCountriesContinent struct {
CountriesContinent CountriesContinent
Valid bool // Valid is true if CountriesContinent is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullCountriesContinent) Scan(value interface{}) error {
if value == nil {
ns.CountriesContinent, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.CountriesContinent.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullCountriesContinent) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.CountriesContinent), nil
}
type CurrencyTransactionLogsCurrencyType string
const (
CurrencyTransactionLogsCurrencyTypeCash CurrencyTransactionLogsCurrencyType = "cash"
CurrencyTransactionLogsCurrencyTypeFuel CurrencyTransactionLogsCurrencyType = "fuel"
CurrencyTransactionLogsCurrencyTypePassengers CurrencyTransactionLogsCurrencyType = "passengers"
)
func (e *CurrencyTransactionLogsCurrencyType) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = CurrencyTransactionLogsCurrencyType(s)
case string:
*e = CurrencyTransactionLogsCurrencyType(s)
default:
return fmt.Errorf("unsupported scan type for CurrencyTransactionLogsCurrencyType: %T", src)
}
return nil
}
type NullCurrencyTransactionLogsCurrencyType struct {
CurrencyTransactionLogsCurrencyType CurrencyTransactionLogsCurrencyType
Valid bool // Valid is true if CurrencyTransactionLogsCurrencyType is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullCurrencyTransactionLogsCurrencyType) Scan(value interface{}) error {
if value == nil {
ns.CurrencyTransactionLogsCurrencyType, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.CurrencyTransactionLogsCurrencyType.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullCurrencyTransactionLogsCurrencyType) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.CurrencyTransactionLogsCurrencyType), nil
}
type PlanesAircraftSize string
const (
PlanesAircraftSizeSmall PlanesAircraftSize = "small"
PlanesAircraftSizeMedium PlanesAircraftSize = "medium"
PlanesAircraftSizeLarge PlanesAircraftSize = "large"
PlanesAircraftSizeHuge PlanesAircraftSize = "huge"
)
func (e *PlanesAircraftSize) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = PlanesAircraftSize(s)
case string:
*e = PlanesAircraftSize(s)
default:
return fmt.Errorf("unsupported scan type for PlanesAircraftSize: %T", src)
}
return nil
}
type NullPlanesAircraftSize struct {
PlanesAircraftSize PlanesAircraftSize
Valid bool // Valid is true if PlanesAircraftSize is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullPlanesAircraftSize) Scan(value interface{}) error {
if value == nil {
ns.PlanesAircraftSize, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.PlanesAircraftSize.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullPlanesAircraftSize) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.PlanesAircraftSize), nil
}
type PlanesAircraftType string
const (
PlanesAircraftTypePlane PlanesAircraftType = "plane"
PlanesAircraftTypeHelicopter PlanesAircraftType = "helicopter"
PlanesAircraftTypeSeaplane PlanesAircraftType = "seaplane"
PlanesAircraftTypeSpaceship PlanesAircraftType = "spaceship"
)
func (e *PlanesAircraftType) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = PlanesAircraftType(s)
case string:
*e = PlanesAircraftType(s)
default:
return fmt.Errorf("unsupported scan type for PlanesAircraftType: %T", src)
}
return nil
}
type NullPlanesAircraftType struct {
PlanesAircraftType PlanesAircraftType
Valid bool // Valid is true if PlanesAircraftType is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullPlanesAircraftType) Scan(value interface{}) error {
if value == nil {
ns.PlanesAircraftType, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.PlanesAircraftType.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullPlanesAircraftType) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.PlanesAircraftType), nil
}
type PlanesOperationType string
const (
PlanesOperationTypePassenger PlanesOperationType = "passenger"
PlanesOperationTypeCargo PlanesOperationType = "cargo"
)
func (e *PlanesOperationType) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = PlanesOperationType(s)
case string:
*e = PlanesOperationType(s)
default:
return fmt.Errorf("unsupported scan type for PlanesOperationType: %T", src)
}
return nil
}
type NullPlanesOperationType struct {
PlanesOperationType PlanesOperationType
Valid bool // Valid is true if PlanesOperationType is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullPlanesOperationType) Scan(value interface{}) error {
if value == nil {
ns.PlanesOperationType, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.PlanesOperationType.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullPlanesOperationType) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.PlanesOperationType), nil
}
type PlayerPlanesStatus string
const (
PlayerPlanesStatusIdle PlayerPlanesStatus = "idle"
PlayerPlanesStatusMaintenance PlayerPlanesStatus = "maintenance"
PlayerPlanesStatusBoarding PlayerPlanesStatus = "boarding"
PlayerPlanesStatusTaxiing PlayerPlanesStatus = "taxiing"
PlayerPlanesStatusFlying PlayerPlanesStatus = "flying"
)
func (e *PlayerPlanesStatus) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = PlayerPlanesStatus(s)
case string:
*e = PlayerPlanesStatus(s)
default:
return fmt.Errorf("unsupported scan type for PlayerPlanesStatus: %T", src)
}
return nil
}
type NullPlayerPlanesStatus struct {
PlayerPlanesStatus PlayerPlanesStatus
Valid bool // Valid is true if PlayerPlanesStatus is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullPlayerPlanesStatus) Scan(value interface{}) error {
if value == nil {
ns.PlayerPlanesStatus, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.PlayerPlanesStatus.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullPlayerPlanesStatus) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.PlayerPlanesStatus), nil
}
type Airport struct {
ID uint32
Name string
UserID int32
OriginCountryID uint16
Cash uint64
CurrentPassengers uint32
MaxPassengerCapacity uint32
CurrentFuel uint32
MaxFuelCapacity uint32
FuelGenerationRate uint32
PassengerGenerationRate uint32
ResourcesLastUpdatedAt time.Time
IsAvailable bool
PlayerLevel uint32
ExperiencePoints uint64
IsDeleted sql.NullBool
}
type AirportBuilding struct {
ID uint32
AirportID uint32
BuildingID uint32
RecipeID sql.NullInt32
StorageProduct sql.NullInt32
Storage1 sql.NullInt32
Storage2 sql.NullInt32
Storage3 sql.NullInt32
Level uint32
}
type AirportContract struct {
ID uint32
AirportID uint32
Title string
RequiredProductID uint16
RequiredAmount uint32
CurrentAmountDelivered uint32
IsCompleted bool
ExpiresAt time.Time
}
type AirportInventory struct {
AirportID uint32
ProductID uint16
Quantity uint32
}
type Building struct {
ID uint32
Name string
MinLevel uint32
ConstructionCostCash uint32
UpgradeTier sql.NullInt16
UpgradeCostCashToUptier sql.NullInt32
BuildingType BuildingsBuildingType
Capacity sql.NullInt32
StorageType NullBuildingsStorageType
StorageSubtype NullBuildingsStorageSubtype
EffectID sql.NullInt16
EffectValue sql.NullInt32
OperationSize NullBuildingsOperationSize
OperationType NullBuildingsOperationType
PassiveType NullBuildingsPassiveType
PassiveRate sql.NullInt32
}
type BuildingProduct struct {
ID uint32
BuildingID uint32
RecipeID sql.NullInt32
StorageProduct sql.NullInt32
Storage1 sql.NullInt32
Storage2 sql.NullInt32
Storage3 sql.NullInt32
}
type CompletedFlightRoutesLog struct {
ID uint32
OriginAirportID uint32
DestinationAirportID uint32
StartTime time.Time
EndTime sql.NullTime
}
type Country struct {
ID uint16
Name string
Continent CountriesContinent
Produce1ID uint16
Produce2ID uint16
Produce3ID uint16
}
type CurrencyTransactionLog struct {
ID uint64
AirportID uint32
AmountChanged int32
CurrencyType CurrencyTransactionLogsCurrencyType
Reason string
CreatedAt sql.NullTime
}
type Effect struct {
ID uint16
Name string
}
type Plane struct {
ID uint32
Name string
MinLevel uint32
OperationCostFuel uint32
OperationCostCash uint32
MaxPassengers sql.NullInt32
TravelTimeInseconds uint32
OperationType PlanesOperationType
AircraftSize PlanesAircraftSize
AircraftType PlanesAircraftType
BuyingCostCash uint32
CompletedFlightExperience uint32
CompletedFlightCashReward sql.NullInt32
CompletedFlightCargoReward sql.NullInt32
}
type PlayerPlane struct {
ID uint32
AirportID uint32
PlaneID uint32
AssignedHangarID uint32
CurrentBuildingID sql.NullInt32
Status PlayerPlanesStatus
UpdatedAt sql.NullTime
FlightStartTime sql.NullTime
}
type Product struct {
ID uint16
Name string
}
type Recipe struct {
ID uint32
Name string
Ingredient1ID sql.NullInt16
Ingredient1Amount sql.NullInt32
Ingredient2ID sql.NullInt16
Ingredient2Amount sql.NullInt32
Ingredient3ID sql.NullInt16
Ingredient3Amount sql.NullInt32
ProductID uint16
YieldAmount uint32
}
type User struct {
ID int32
Username string
PasswordHash string
CreatedAt sql.NullTime
DeletedAt sql.NullTime
}