naise_pos/db/sqlc/models.go
2023-03-19 18:17:17 +07:00

203 lines
6.5 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.17.2
package db
import (
"database/sql"
"database/sql/driver"
"encoding/json"
"fmt"
"time"
"github.com/google/uuid"
"github.com/tabbed/pqtype"
)
type StockLogsType string
const (
StockLogsTypeIn StockLogsType = "in"
StockLogsTypeOut StockLogsType = "out"
)
func (e *StockLogsType) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = StockLogsType(s)
case string:
*e = StockLogsType(s)
default:
return fmt.Errorf("unsupported scan type for StockLogsType: %T", src)
}
return nil
}
type NullStockLogsType struct {
StockLogsType StockLogsType
Valid bool // Valid is true if StockLogsType is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullStockLogsType) Scan(value interface{}) error {
if value == nil {
ns.StockLogsType, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.StockLogsType.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullStockLogsType) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.StockLogsType), nil
}
type Customer struct {
ID uuid.UUID `json:"id"`
IndexID int64 `json:"index_id"`
MerchantID uuid.UUID `json:"merchant_id"`
Name string `json:"name"`
Detail []json.RawMessage `json:"detail"`
CreatedAt sql.NullTime `json:"created_at"`
UpdatedAt sql.NullTime `json:"updated_at"`
}
type Merchant struct {
ID uuid.UUID `json:"id"`
IndexID int64 `json:"index_id"`
Name string `json:"name"`
OwnerID uuid.UUID `json:"owner_id"`
CreatedAt sql.NullTime `json:"created_at"`
UpdatedAt sql.NullTime `json:"updated_at"`
}
type Product struct {
ID uuid.UUID `json:"id"`
MerchantID uuid.UUID `json:"merchant_id"`
IndexID int64 `json:"index_id"`
Name string `json:"name"`
SellingPrice float64 `json:"selling_price"`
PurchasePrice float64 `json:"purchase_price"`
Stock float64 `json:"stock"`
CreatedAt sql.NullTime `json:"created_at"`
UpdatedAt sql.NullTime `json:"updated_at"`
ProductCategoryID uuid.UUID `json:"product_category_id"`
}
type ProductCategory struct {
ID uuid.UUID `json:"id"`
MerchantID uuid.UUID `json:"merchant_id"`
IndexID int64 `json:"index_id"`
Name string `json:"name"`
}
type PurchaseOrder struct {
ID uuid.UUID `json:"id"`
SupplierID uuid.UUID `json:"supplier_id"`
MerchantID uuid.UUID `json:"merchant_id"`
IndexID int64 `json:"index_id"`
Code sql.NullString `json:"code"`
IsPaid bool `json:"is_paid"`
Total float64 `json:"total"`
PaidNominal float64 `json:"paid_nominal"`
Note sql.NullString `json:"note"`
CreatedAt sql.NullTime `json:"created_at"`
UpdatedAt sql.NullTime `json:"updated_at"`
}
type PurchaseOrderDetail struct {
ID uuid.UUID `json:"id"`
IndexID int64 `json:"index_id"`
Code sql.NullString `json:"code"`
MerchantID uuid.UUID `json:"merchant_id"`
PurchaseOrderID uuid.UUID `json:"purchase_order_id"`
ProductID uuid.UUID `json:"product_id"`
Quantity float64 `json:"quantity"`
SubTotal float64 `json:"sub_total"`
ProductPrice float64 `json:"product_price"`
CreatedAt sql.NullTime `json:"created_at"`
UpdatedAt sql.NullTime `json:"updated_at"`
}
type SaleOrder struct {
ID uuid.UUID `json:"id"`
IndexID int64 `json:"index_id"`
Code sql.NullString `json:"code"`
MerchantID uuid.UUID `json:"merchant_id"`
CustomerID uuid.NullUUID `json:"customer_id"`
IsPaid sql.NullBool `json:"is_paid"`
Total float64 `json:"total"`
PaidNominal float64 `json:"paid_nominal"`
Note sql.NullString `json:"note"`
CreatedAt sql.NullTime `json:"created_at"`
UpdatedAt sql.NullTime `json:"updated_at"`
}
type SaleOrderDetail struct {
ID uuid.UUID `json:"id"`
IndexID int64 `json:"index_id"`
SaleOrderID uuid.UUID `json:"sale_order_id"`
ProductID uuid.UUID `json:"product_id"`
ProductName string `json:"product_name"`
Quantity float64 `json:"quantity"`
SubTotal float64 `json:"sub_total"`
ProductPrice float64 `json:"product_price"`
Profit float64 `json:"profit"`
CreatedAt sql.NullTime `json:"created_at"`
UpdatedAt sql.NullTime `json:"updated_at"`
}
type StockLog struct {
ID uuid.UUID `json:"id"`
IndexID int64 `json:"index_id"`
MerchantID uuid.UUID `json:"merchant_id"`
ProductID uuid.UUID `json:"product_id"`
CreatedBy uuid.UUID `json:"created_by"`
TransactionID uuid.NullUUID `json:"transaction_id"`
TransactionActionType string `json:"transaction_action_type"`
TransactionDescription string `json:"transaction_description"`
Type StockLogsType `json:"type"`
SellingPrice float64 `json:"selling_price"`
PurchasePrice float64 `json:"purchase_price"`
Quantity float64 `json:"quantity"`
CreatedAt sql.NullTime `json:"created_at"`
UpdatedAt sql.NullTime `json:"updated_at"`
}
type Supplier struct {
ID uuid.UUID `json:"id"`
IndexID int64 `json:"index_id"`
MerchantID uuid.UUID `json:"merchant_id"`
Name string `json:"name"`
Detail pqtype.NullRawMessage `json:"detail"`
CreatedAt sql.NullTime `json:"created_at"`
UpdatedAt sql.NullTime `json:"updated_at"`
}
type User struct {
ID uuid.UUID `json:"id"`
IndexID int64 `json:"index_id"`
Email string `json:"email"`
Password string `json:"password"`
Fullname string `json:"fullname"`
CreatedAt sql.NullTime `json:"created_at"`
UpdatedAt sql.NullTime `json:"updated_at"`
}
type UserSession struct {
ID uuid.UUID `json:"id"`
IndexID int64 `json:"index_id"`
Email string `json:"email"`
RefreshToken string `json:"refresh_token"`
UserAgent string `json:"user_agent"`
ClientIp string `json:"client_ip"`
IsBlocked bool `json:"is_blocked"`
ExpiresAt time.Time `json:"expires_at"`
CreatedAt sql.NullTime `json:"created_at"`
}