db

package
v0.0.0-...-95fffc9 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteUnitDB

func DeleteUnitDB(db *sql.DB, name string) error

DeleteUnitDB deletes a unit from database

func InitDB

func InitDB(filepath string) error

InitDB creates an empty database

func InsertUnitDB

func InsertUnitDB(db *sql.DB, unit BraveUnit) (int64, error)

InsertUnitDB inserts a unit into database

func OpenDB

func OpenDB(filepath string) (db *sql.DB, err error)

OpenDB opens database

Types

type BraveUnit

type BraveUnit struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
	UID  string `json:"uid"`
	Date string `json:"date"`
	Data []byte `json:"unitData"`
}

BraveUnit type to store unit data in DB

type Unit

type Unit struct {
	ID   int64
	Name string
	UID  string
	Date string
	Data UnitData
}

Unit Brave unit object

func GetAllUnitsDB

func GetAllUnitsDB(db *sql.DB) (units []Unit, err error)

GetAllUnitsDB returns all units

func GetUnitDB

func GetUnitDB(db *sql.DB, name string) (unit Unit, err error)

GetUnitDB returns a unit from database by name

type UnitData

type UnitData struct {
	IP    string `json:"ip"`
	Image string `json:"image"`
	CPU   int    `json:"cpu"`
	RAM   string `json:"ram"`
}

UnitData Brave unit metadata

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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