model

package
v0.0.0-...-5bd05a1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	gorm.Model
	ID         string `json:"id" gorm:"primaryKey"`
	Status     string
	StatusInfo string
	CredUrl    string
	SourceID   *string
	Source     *Source
	Version    string
	Associated bool
}

func NewAgentFromApiResource

func NewAgentFromApiResource(resource *apiAgent.AgentStatusUpdate) *Agent

func NewAgentFromID

func NewAgentFromID(id string) *Agent

func (Agent) String

func (a Agent) String() string

func (*Agent) ToApiResource

func (a *Agent) ToApiResource() api.Agent

type AgentList

type AgentList []Agent

func (AgentList) ToApiResource

func (al AgentList) ToApiResource() api.AgentList

type JSONField

type JSONField[T any] struct {
	Data T
}

JSONField wraps an arbitrary struct so that it can be included in a GORM model, for use in a JSON/JSONB field

func MakeJSONField

func MakeJSONField[T any](data T) *JSONField[T]

Return a copy of 'data', wrapped in a JSONField object

func (JSONField[T]) MarshalJSON

func (j JSONField[T]) MarshalJSON() ([]byte, error)

func (*JSONField[T]) Scan

func (j *JSONField[T]) Scan(src any) error

func (*JSONField[T]) UnmarshalJSON

func (j *JSONField[T]) UnmarshalJSON(b []byte) error

func (JSONField[T]) Value

func (j JSONField[T]) Value() (driver.Value, error)

type Source

type Source struct {
	ID        openapi_types.UUID `json:"id" gorm:"primaryKey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt            `gorm:"index"`
	Inventory *JSONField[api.Inventory] `gorm:"type:jsonb"`
	Agents    []Agent                   `gorm:"constraint:OnDelete:SET NULL;"`
}

func NewSourceFromApiCreateResource

func NewSourceFromApiCreateResource(id uuid.UUID) *Source

func NewSourceFromId

func NewSourceFromId(id uuid.UUID) *Source

func (Source) String

func (s Source) String() string

func (*Source) ToApiResource

func (s *Source) ToApiResource() api.Source

type SourceList

type SourceList []Source

func (SourceList) ToApiResource

func (sl SourceList) ToApiResource() api.SourceList

Jump to

Keyboard shortcuts

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