models

package
v0.0.0-...-f25915b Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	ID       string    `gorm:"column:id;primaryKey;type:uuid;default:uuid_generate_v4()" json:"-"`
	Services []Service `gorm:"foreignKey:ApplicationID;references:id"`

	Name        string `gorm:"column:name;type:varchar(20);not null" json:"-"`
	Description string `gorm:"column:description;type:varchar(50)" json:"-"`
	CreatedAt   int64  `gorm:"column:created_at;autoCreateTime" json:"-"`
	UpdatedAt   int64  `gorm:"column:updated_at;autoUpdateTime" json:"-"`
}

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

type ApplicationOrmer

type ApplicationOrmer interface {
	GetAll() (applications []Application, err error)
	GetAllShowcaseWithServices() (applications []Application, err error)
	GetOneByID(ID string) (application Application, err error)
	Insert(application Application) (ID string, err error)
	Update(application Application) (err error)
	DeleteByID(ID string) (err error)
}

func NewApplicationOrmer

func NewApplicationOrmer(db *gorm.DB) ApplicationOrmer

type Report

type Report struct {
	ApplicationID string `json:"-"`
	ServiceID     string `json:"-"`
	Latency       int64  `json:"-"`
	Timestamp     int64  `json:"-"`
}

type ReportOrmer

type ReportOrmer interface {
	GetWindowByApplicationIDAndServiceID(applicationID, serviceID string) (reports []Report, err error)
	Insert(report Report) (err error)
}

func NewReportOrmer

func NewReportOrmer(influx influxdb2.Client, organization, bucket string) ReportOrmer

type Service

type Service struct {
	ID            string      `gorm:"column:id;primaryKey;type:uuid;default:uuid_generate_v4()" json:"-"`
	Application   Application `gorm:"foreignKey:ApplicationID;references:id;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"-"`
	ApplicationID string      `json:"-"`

	Name        string `gorm:"column:name;type:varchar(20);not null" json:"-"`
	Description string `gorm:"column:description;type:varchar(50)" json:"-"`
	Endpoint    string `gorm:"column:endpoint;type:varchar(50)" json:"-"`
	Type        string `gorm:"column:type;type:varchar(5)" json:"-"`
	Config      string `gorm:"column:config;type:text" json:"-"`
	Enabled     bool   `gorm:"column:enabled;default:false" json:"-"`
	Showcase    bool   `gorm:"column:showcase;default:false" json:"-"`

	CreatedAt int64 `gorm:"column:created_at;autoCreateTime" json:"-"`
	UpdatedAt int64 `gorm:"column:updated_at;autoUpdateTime" json:"-"`
}

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

type ServiceOrmer

type ServiceOrmer interface {
	GetAllByApplicationID(applicationID string) (services []Service, err error)
	GetAllEnabled() (services []Service, err error)
	GetOneByIDAndApplicationID(ID, applicationID string) (service Service, err error)
	Insert(service Service) (ID string, err error)
	Update(service Service) (err error)
	DeleteByIDAndApplicationID(ID, applicationID string) (err error)
}

func NewServiceOrmer

func NewServiceOrmer(db *gorm.DB) ServiceOrmer

Jump to

Keyboard shortcuts

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