models

package
v0.0.0-...-8fb0621 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: MPL-2.0 Imports: 7 Imported by: 3

Documentation

Overview

Package models :

Package models :

Package models :

Package models :

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareHashAndPassword

func CompareHashAndPassword(hashedPassword, password string) (result bool)

func HashAndSaltPassword

func HashAndSaltPassword(password string) (hashedPassword string)

TODO REMOVE OU REVOIR

Types

type Authorization

type Authorization struct {
	Model
	UserID   uuid.UUID `gorm:"type:uuid"`
	User     User
	RoleID   uuid.UUID `gorm:"type:uuid"`
	Role     Role
	DomainID uuid.UUID `gorm:"type:uuid"`
	Domain   Domain
}

type Command

type Command struct {
	Model
	UUID      string
	Tenant    string
	Token     string
	Timeout   int64
	Timestamp int64
	Payload   string
	Major     int8
	Minor     int8
	Target    string
	Command   string
}

Command : Command struct.

func FromShosetCommand

func FromShosetCommand(mcommand msg.Command) (command Command)

FromShosetCommand : Shoset command to core command.

type CommandType

type CommandType struct {
	Model
	Name               string    `gorm:"unique;not null"`
	Schema             string    //`gorm:"unique;not null"`
	PivotID            uuid.UUID `` /* 137-byte string literal not displayed */
	Pivot              Pivot
	ProductConnectorID uuid.UUID `` /* 137-byte string literal not displayed */
	ProductConnector   ProductConnector
}

type Config

type Config struct {
	Model
	UUID      string
	Tenant    string
	Token     string
	Timeout   int64
	Timestamp int64
	Payload   string
	Major     int8
	Minor     int8
	Target    string
	Command   string
}

Config : Config struct.

func FromShosetConfig

func FromShosetConfig(mconfig msg.Config) (config Config)

FromShosetConfig : Shoset config to core config.

type ConfigurationDatabaseAggregator

type ConfigurationDatabaseAggregator struct {
	Tenant              string
	Password            string
	DatabaseBindAddress string
}

func NewConfigurationDatabaseAggregator

func NewConfigurationDatabaseAggregator(tenant, password, bindAddress string) *ConfigurationDatabaseAggregator

type ConnectorProduct

type ConnectorProduct struct {
	Model
	Name string `gorm:"unique;not null"`
}

type CreateDatabase

type CreateDatabase struct {
	Login    []string
	Password []string
}

func NewCreateDatabase

func NewCreateDatabase(login, password []string) *CreateDatabase

type Domain

type Domain struct {
	Model
	Name             string    `gorm:"not null"`
	ParentID         uuid.UUID `gorm:"type:uuid"`
	Parent           *Domain   `gorm:"constraint:OnDelete:CASCADE;"`
	Authorizations   []Authorization
	Products         []Product
	Libraries        []Library `gorm:"many2many:domain_libraries;"`
	Tags             []Tag     `gorm:"many2many:domain_tags;"`
	Environments     []Environment
	ShortDescription string
	Description      string
	GitURL           string
	Childs           []*Domain
}

func (*Domain) BeforeDelete

func (d *Domain) BeforeDelete(tx *gorm.DB) (err error)

type Environment

type Environment struct {
	Model
	Name              string    `gorm:"not null"`
	EnvironmentTypeID uuid.UUID `gorm:"type:uuid"`
	EnvironmentType   EnvironmentType
	ShortDescription  string
	Description       string
	DomainID          uuid.UUID `gorm:"type:uuid"`
	Domain            Domain
}

type EnvironmentType

type EnvironmentType struct {
	Model
	Name             string `gorm:"not null"`
	ShortDescription string
	Description      string
}

type Event

type Event struct {
	Model
	UUID          string
	Tenant        string
	Token         string
	Timeout       int64
	Timestamp     int64
	Payload       string
	Major         int8
	Minor         int8
	Topic         string
	Event         string
	ReferenceUUID string
}

Event : Event struct.

func FromShosetEvent

func FromShosetEvent(mevent msg.Event) (event Event)

FromShosetEvent : Shoset event to core event.

type EventType

type EventType struct {
	Model
	Name               string    `gorm:"unique;not null"`
	Schema             string    //`gorm:"unique;not null"`
	PivotID            uuid.UUID `` /* 137-byte string literal not displayed */
	Pivot              Pivot
	ProductConnectorID uuid.UUID `` /* 137-byte string literal not displayed */
	ProductConnector   ProductConnector
}

type EventTypeToPoll

type EventTypeToPoll struct {
	Model
	ResourceID  uuid.UUID `gorm:"type:uuid;UNIQUE_INDEX:compositeindex;not null"`
	Resource    Resource
	EventTypeID uuid.UUID `gorm:"type:uuid;UNIQUE_INDEX:compositeindex;not null"`
	EventType   EventType
}

type Heartbeat

type Heartbeat struct {
	Model
	LogicalName string
	Type        string
	Address     string
}

func FromShosetHeartbeat

func FromShosetHeartbeat(mheartbeat cmsg.Heartbeat) (heartbeat Heartbeat)

FromShosetCommand : Shoset command to core command.

type Key

type Key struct {
	Model
	Name               string
	DefaultValue       string
	Type               string
	Shortname          string
	Mandatory          bool
	PivotID            uuid.UUID `` /* 137-byte string literal not displayed */
	Pivot              Pivot
	ProductConnectorID uuid.UUID `` /* 137-byte string literal not displayed */
	ProductConnector   ProductConnector
}

type KeyValue

type KeyValue struct {
	Model
	Value              string
	KeyID              uuid.UUID `gorm:"type:uuid"`
	Key                Key
	LogicalComponentID uuid.UUID `gorm:"type:uuid"`
	LogicalComponent   LogicalComponent
}

type Library

type Library struct {
	Model
	Name             string `gorm:"unique;not null"`
	ShortDescription string
	Description      string
}

type LogicalComponent

type LogicalComponent struct {
	Model
	LogicalName        string    `gorm:"unique;not null"`
	Type               string    //connector/cluster/aggregator
	PivotID            uuid.UUID `` /* 127-byte string literal not displayed */
	Pivot              Pivot
	ProductConnectorID uuid.UUID `gorm:"type:uuid;check:pivot_id IS NULL AND  product_connector_id IS NOT NULL AND type == 'connector'"`
	ProductConnector   ProductConnector
	Aggregator         string     `gorm:"check:aggregator IS NOT NULL AND type == 'connector'"`
	KeyValues          []KeyValue `gorm:"foreignkey:LogicalComponentID"`
	Resources          []Resource `gorm:"foreignkey:LogicalComponentID"`
	ShortDescription   string
	Description        string
}

func (LogicalComponent) GetKeyValueByKey

func (lc LogicalComponent) GetKeyValueByKey(key string) *KeyValue

type Model

type Model struct {
	ID        uuid.UUID `gorm:"type:uuid;primary_key;"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

func (*Model) BeforeCreate

func (model *Model) BeforeCreate(scope *gorm.Scope) error

BeforeCreate will set a UUID rather than numeric ID.

type Pivot

type Pivot struct {
	Model
	Name          string `gorm:"UNIQUE_INDEX:compositeindex;not null"`
	Major         int8   `gorm:"UNIQUE_INDEX:compositeindex;not null"`
	Minor         int8   `gorm:"UNIQUE_INDEX:compositeindex;not null"`
	ResourceTypes []ResourceType
	CommandTypes  []CommandType
	EventTypes    []EventType
	Keys          []Key
}

type Product

type Product struct {
	Model
	Name             string `gorm:"unique;not null"`
	ShortDescription string
	Description      string
	RepositoryURL    string
	DomainID         uuid.UUID `gorm:"type:uuid"`
	Domain           Domain
}

func (*Product) AfterCreate

func (p *Product) AfterCreate(tx *gorm.DB) (err error)

type ProductConnector

type ProductConnector struct {
	Model
	Name          string `gorm:"unique;not null"`
	Major         int8
	Minor         int8
	PivotID       uuid.UUID `gorm:"type:uuid"`
	Pivot         Pivot
	ProductID     uuid.UUID `gorm:"type:uuid"`
	Product       ConnectorProduct
	ResourceTypes []ResourceType `gorm:"ForeignKey:ProductConnectorID"`
	CommandTypes  []CommandType  `gorm:"ForeignKey:ProductConnectorID"`
	EventTypes    []EventType    `gorm:"ForeignKey:ProductConnectorID"`
	Keys          []Key          `gorm:"ForeignKey:ProductConnectorID"`
}

type Resource

type Resource struct {
	Model
	Name               string    `gorm:"unique;not null"`
	LogicalComponentID uuid.UUID `gorm:"type:uuid"`
	LogicalComponent   LogicalComponent
	DomainID           uuid.UUID `gorm:"type:uuid"`
	Domain             Domain
	ResourceTypeID     uuid.UUID `gorm:"type:uuid"`
	ResourceType       ResourceType
	EventTypeToPolls   []EventTypeToPoll `gorm:"ForeignKey:ResourceID"`
}

type ResourceAuthorization

type ResourceAuthorization struct {
	Model
	RoleID         uuid.UUID `gorm:"type:uuid"`
	Role           Role
	DomainID       uuid.UUID `gorm:"type:uuid"`
	Domain         Domain
	ResourceTypeID uuid.UUID `gorm:"type:uuid"`
	ResourceType   ResourceType
	Allow          bool
}

type ResourceType

type ResourceType struct {
	Model
	Name               string    `gorm:"unique;not null"`
	PivotID            uuid.UUID `` /* 137-byte string literal not displayed */
	Pivot              Pivot
	ProductConnectorID uuid.UUID `` /* 137-byte string literal not displayed */
	ProductConnector   ProductConnector
}

type Role

type Role struct {
	Model
	Name             string `gorm:"unique;not null"`
	ShortDescription string
	Description      string
}

Role : Role struct.

type Secret

type Secret struct {
	Model
	UUID              string
	Tenant            string
	Timeout           int64
	Timestamp         int64
	Payload           string
	TargetLogicalName string
	TargetAddress     string
	Command           string
}

Secret : Secret struct.

func FromShosetSecret

func FromShosetSecret(msecret msg.Secret) (secret Secret)

FromShosetSecret : Shoset secret to core secret.

type SecretAssignement

type SecretAssignement struct {
	Secret    string `gorm:"primaryKey;unique"`
	AddressIP string
}

type State

type State struct {
	Model
	Admin bool
}

State : State struct.

type Tag

type Tag struct {
	Model
	Name             string    `gorm:"not null"`
	ParentID         uuid.UUID `gorm:"type:uuid"`
	Parent           *Tag      `gorm:"constraint:OnDelete:CASCADE;"`
	ShortDescription string
	Description      string
	Childs           []*Tag
}

func (*Tag) BeforeDelete

func (t *Tag) BeforeDelete(tx *gorm.DB) (err error)

type Tenant

type Tenant struct {
	Model
	Name             string `gorm:"unique"`
	Password         string
	ShortDescription string
	Description      string
}

Tenant : Tenant struct.

type User

type User struct {
	Model
	Email       string `gorm:"unique;not null"`
	Password    string
	FirstName   string
	LastName    string
	CompanyId   string
	Description string
}

User : user struct

func NewUser

func NewUser(email, firstname, secondname, companyid, password, description string) User

NewUser : create new user

type Version

type Version struct {
	Major int8
	Minor int8
}

Jump to

Keyboard shortcuts

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