models

package
v0.0.0-...-0d7a5af Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Global instance DB connection

Functions

func InitDB

func InitDB(cfg Config)

Initialize DB connection with PostgreSQL

Types

type Config

type Config struct {
	Host     string
	Port     string
	User     string
	Password string
	DBName   string
	SSLMode  string
}

type Product

type Product struct {
	gorm.Model
	Name           string  `json:"name" binding:"required"`
	Description    string  `json:"description"`
	Price          float32 `json:"price" binding:"required,gte=0"`
	Category       string  `json:"category" binding:"required"`
	Stock_Quantity float32 `json:"stock_quantity" binding:"required"`
	CreatedOn      string  `json:"-"`
	UpdatedOn      string  `json:"-"`
	DeletedOn      string  `json:"-"`
}

swagger:model Product

type Products

type Products []*Product

Jump to

Keyboard shortcuts

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