models

package
v0.0.0-...-e27868a Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

DB database

Functions

func ConnectDataBase

func ConnectDataBase()

ConnectDataBase connect database

Types

type APIResponse

type APIResponse struct {
	Code         int    `json:"code"`
	ResponseType string `json:"type"`
	Message      string `json:"message"`
}

APIResponse is the response for the API when an object is not returned

type Address

type Address struct {
	ID         int64  `gorm:"primary_key"`
	Street     string `json:"street"`
	City       string `json:"city"`
	State      string `json:"state"`
	Zip        string `json:"zip"`
	CustomerID int64
}

Address is a struct containing address details.

type Category

type Category struct {
	ID    int64  `json:"id" gorm:"primary_key"`
	Name  string `json:"name"`
	PetID int64
}

Category of pet

type Customer

type Customer struct {
	ID       int64   `json:"id" gorm:"primary_key"`
	Username string  `json:"username"`
	Address  Address `json:"address" gorm:"foreignKey:CustomerID"`
}

Customer represents a customer on an main.Order

type Order

type Order struct {
	ID       int64       `json:"id" gorm:"primary_key"`
	PetID    int64       `json:"petId"`
	Quantity int         `json:"quantity"`
	ShipDate string      `json:"shipDate"`
	Status   OrderStatus `json:"status"`
	Complete bool        `json:"complete"`
}

Order in a store

type OrderStatus

type OrderStatus string

OrderStatus is an enum

type Pet

type Pet struct {
	ID       int64     `json:"id" gorm:"primary_key"`
	Name     string    `json:"name"`
	Category Category  `json:"category" gorm:"foreignKey:PetID"`
	Photos   []Photo   `gorm:"foreignKey:PetID"`
	Tags     []Tag     `json:"tags" gorm:"foreignKey:PetID"`
	Status   PetStatus `json:"status"`
	Orders   []Order   `gorm:"foreignKey:PetID"`
}

Pet is the pet struct

type PetStatus

type PetStatus string

PetStatus is an enum

type Photo

type Photo struct {
	ID    int64 `gorm:"primary_key"`
	URL   string
	PetID int64
}

Photo contains photo info

type Tag

type Tag struct {
	ID    int64  `json:"id" gorm:"primary_key"`
	Name  string `json:"name"`
	PetID int64
}

Tag for pet

type User

type User struct {
	ID         int64  `json:"id" gorm:"primary_key"`
	Username   string `json:"username"`
	FirstName  string `json:"firstName"`
	LastName   string `json:"lastName"`
	Email      string `json:"email"`
	Password   string `json:"password"`
	Phone      string `json:"phone"`
	UserStatus int    `json:"userStatus"`
}

User represents a customer

Jump to

Keyboard shortcuts

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