db

package
v0.0.0-...-2119b44 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNodeRepo

func NewNodeRepo(db sql.Db) *nodeRepo

func NewOrgRepo

func NewOrgRepo(db sql.Db) *orgRepo

func NewSystemRepo

func NewSystemRepo(db sql.Db) *systemRepo

Types

type Node

type Node struct {
	gorm.Model
	NodeID string `gorm:"type:string;uniqueIndex:node_id_idx_case_insensetive,expression:lower(node_id);size:23;not null"`
	OrgID  uint
	Org    Org
}

type NodeRepo

type NodeRepo interface {
	AddOrUpdate(node *Node) error
	Get(nodeId ukama.NodeID) (*Node, error)
	Delete(nodeId ukama.NodeID) error
}

type Org

type Org struct {
	gorm.Model
	Name        string    `gorm:"uniqueIndex"`
	OrgId       uuid.UUID `gorm:"type:uuid;uniqueIndex:org_id_unique_index,where:deleted_at is null;not null;column_name:org_org_id;"`
	Certificate string
	Ip          pgtype.Inet `gorm:"type:inet"`
	Nodes       []Node
	Systems     []System
}

type OrgRepo

type OrgRepo interface {
	Add(org *Org) error
	Update(org *Org) error
	GetByName(name string) (*Org, error)
	GetById(id uuid.UUID) (*Org, error)
}

type System

type System struct {
	gorm.Model
	Name        string `gorm:"type:string;index:sys_idx,unique,composite:sys_idx,expression:lower(name);not null"`
	Uuid        string `gorm:"type:uuid;unique"`
	Certificate string
	Ip          pgtype.Inet `gorm:"type:inet"`
	Port        int32
	OrgID       uint `gorm:"type:string;index:sys_idx,unique,composite:sys_idx;not null"`
	Org         Org
	Health      uint32 `gorm:"default:100"`
}

type SystemRepo

type SystemRepo interface {
	Add(sys *System) error
	Update(sys *System, org uint) error
	Delete(sys string, org uint) error
	GetByName(sys string, org uint) (*System, error)
}

Jump to

Keyboard shortcuts

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