models

package
v0.0.0-...-6696c37 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMaterial

func AddMaterial(material Material) error

func CreateUser

func CreateUser(user User) error

func MakeMigrations

func MakeMigrations()

Types

type InsulationLayer

type InsulationLayer struct {
	Material  Material `json:"material"`
	Thickness float64  `json:"thickness"`
	UValue    float64  `json:"u_value"`
}

New structs for insulation calculation

type InsulationResult

type InsulationResult struct {
	Layers      []InsulationLayer `json:"layers"`
	TotalUValue float64           `json:"total_u_value"`
	TotalCost   float64           `json:"total_cost"`
}

type Material

type Material struct {
	ID          uint64  `json:"id" toml:"id"`
	CreatedBy   uint64  `json:"created_by" toml:"created_by"`
	Name        string  `json:"name" toml:"name"`
	Description string  `json:"description,omitempty" toml:"description"`
	Lambda      float64 `json:"lambda" toml:"lambda"`
	Price       float64 `json:"price,omitempty" toml:"price"`
	Thickness   float64 `json:"thickness" toml:"thickness"`
	Type        string  `json:"type" toml:"type"`
}

func GetAllMaterials

func GetAllMaterials() ([]Material, error)

func GetMaterialsByIDs

func GetMaterialsByIDs(ids []string) ([]Material, error)

func LoadMaterialsFromTOML

func LoadMaterialsFromTOML(filename string) ([]Material, error)

LoadMaterialsFromTOML loads materials from a TOML file

func ReadMaterialsFromTomlFile

func ReadMaterialsFromTomlFile(filePath string) ([]Material, error)

func (*Material) CreateMaterial

func (t *Material) CreateMaterial() (Material, error)

func (*Material) DeleteMaterial

func (t *Material) DeleteMaterial() error

func (*Material) GetAllMaterials

func (t *Material) GetAllMaterials() ([]Material, error)

func (*Material) GetMaterialById

func (t *Material) GetMaterialById() (Material, error)

func (*Material) SearchMaterial

func (t *Material) SearchMaterial(search Search) ([]Material, error)

func (*Material) UpdateMaterial

func (t *Material) UpdateMaterial() (Material, error)
type Search struct {
	Name   string  `json:"name"`
	Lambda float64 `json:"lambda"`
	Price  float64 `json:"price"`
}

type TOMLData

type TOMLData struct {
	Insulation []Material `toml:"insulation"`
	Other      []Material `toml:"other"`
	Wall       []Material `toml:"wall"`
}

TOMLData represents the structure of your TOML file

type Todo

type Todo struct {
	ID          uint64 `json:"id"`
	CreatedBy   uint64 `json:"created_by"`
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	Status      bool   `json:"status,omitempty"`
}

func (*Todo) CreateTodo

func (t *Todo) CreateTodo() (Todo, error)

func (*Todo) DeleteTodo

func (t *Todo) DeleteTodo() error

func (*Todo) GetAllTodos

func (t *Todo) GetAllTodos() ([]Todo, error)

func (*Todo) GetNoteById

func (t *Todo) GetNoteById() (Todo, error)

func (*Todo) UpdateTodo

func (t *Todo) UpdateTodo() (Todo, error)

type User

type User struct {
	ID       uint64 `json:"id"`
	Email    string `json:"email"`
	Password string `json:"password"`
	Username string `json:"username"`
}

func CheckEmail

func CheckEmail(email string) (User, error)

func GetUserById

func GetUserById(id string) (User, error)

Jump to

Keyboard shortcuts

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