models

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EventChan = make(chan Event) //nolint:gochecknoglobals

Functions

func Active added in v0.2.2

func Active(db *gorm.DB) *gorm.DB

Types

type Bundle

type Bundle struct {
	ID   string `gorm:"primaryKey"`
	Name string
}

type Catalog added in v1.2.0

type Catalog struct {
	ID                  string          `json:"id" gorm:"primaryKey"`
	Name                string          `json:"name" gorm:"not null"`
	AlternativeID       *string         `json:"alternativeId,omitempty" gorm:"uniqueIndex"`
	Active              *bool           `json:"active" gorm:"default:true;not null"`
	PublishersNamespace *string         `json:"publishersNamespace,omitempty"`
	Sources             []CatalogSource `json:"sources" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	CreatedAt           time.Time       `json:"createdAt" gorm:"index"`
	UpdatedAt           time.Time       `json:"updatedAt"`
}

func (Catalog) TableName added in v1.2.0

func (Catalog) TableName() string

func (Catalog) UUID added in v1.2.0

func (c Catalog) UUID() string

type CatalogSource added in v1.2.0

type CatalogSource struct {
	ID        string    `json:"-" gorm:"primaryKey"`
	Driver    *string   `json:"driver,omitempty" gorm:"index"`
	URL       string    `json:"url" gorm:"not null"`
	Args      []string  `json:"args,omitempty" gorm:"serializer:json"`
	CatalogID string    `json:"-" gorm:"not null;index"`
	CreatedAt time.Time `json:"-" gorm:"index"`
	UpdatedAt time.Time `json:"-"`
}

func (CatalogSource) TableName added in v1.2.0

func (CatalogSource) TableName() string

type CodeHosting

type CodeHosting struct {
	ID          string    `json:"-" gorm:"primaryKey"`
	URL         string    `json:"url" gorm:"not null;uniqueIndex"`
	Group       *bool     `json:"group" gorm:"default:true;not null"`
	PublisherID string    `json:"-"`
	CreatedAt   time.Time `json:"createdAt" gorm:"index"`
	UpdatedAt   time.Time `json:"updatedAt"`
}

func (CodeHosting) TableName added in v0.4.0

func (CodeHosting) TableName() string

type Event added in v0.3.0

type Event struct {
	ID         string `gorm:"primaryKey"`
	Type       string
	EntityType string
	EntityID   string
	CreatedAt  time.Time
	UpdatedAt  time.Time
	DeletedAt  gorm.DeletedAt `gorm:"index"`
}

type Log

type Log struct {
	ID        string         `json:"id" gorm:"primaryKey"`
	Message   string         `json:"message" gorm:"not null"`
	CreatedAt time.Time      `json:"createdAt" gorm:"index"`
	UpdatedAt time.Time      `json:"updatedAt"`
	DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`

	// Entity this Log entry is about (fe. Publisher, Software, etc.)
	EntityID   *string `json:"-"`
	EntityType *string `json:"-"`
	Entity     string  `` //nolint:lll
	/* 173-byte string literal not displayed */
}

type Model added in v0.3.0

type Model interface {
	TableName() string
	UUID() string
}

type Publisher

type Publisher struct {
	ID            string        `json:"id" gorm:"primaryKey"`
	CatalogID     *string       `json:"catalogId,omitempty" gorm:"index"`
	Email         *string       `json:"email,omitempty"`
	Description   string        `json:"description" gorm:"uniqueIndex;not null"`
	CodeHosting   []CodeHosting `json:"codeHosting" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	Active        *bool         `json:"active" gorm:"default:true;not null"`
	AlternativeID *string       `json:"alternativeId,omitempty" gorm:"uniqueIndex"`
	CreatedAt     time.Time     `json:"createdAt" gorm:"index"`
	UpdatedAt     time.Time     `json:"updatedAt"`
}

func (Publisher) AfterCreate added in v0.3.0

func (p Publisher) AfterCreate(trx *gorm.DB) error

func (Publisher) AfterDelete added in v0.3.0

func (p Publisher) AfterDelete(trx *gorm.DB) error

func (Publisher) AfterUpdate added in v0.3.0

func (p Publisher) AfterUpdate(trx *gorm.DB) error

func (Publisher) TableName added in v0.3.0

func (Publisher) TableName() string

func (Publisher) UUID added in v0.3.0

func (p Publisher) UUID() string

type Software

type Software struct {
	ID        string  `json:"id" gorm:"primarykey"`
	CatalogID *string `json:"catalogId,omitempty" gorm:"index"`

	// This needs to be explicitly declared, otherwise GORM won't create
	// the foreign key and will be confused about the double relationship
	// with SoftwareURLs (belongs to and has many).
	SoftwareURLID string `json:"-" gorm:"uniqueIndex;not null"`

	URL           SoftwareURL         `json:"url"`
	Aliases       SoftwareURLSlice    `json:"aliases"`
	PubliccodeYml string              `json:"publiccodeYml"`
	Logs          []Log               `json:"-" gorm:"polymorphic:Entity;"`
	Active        *bool               `json:"active" gorm:"default:true;not null"`
	Vitality      *string             `json:"vitality"`
	Analysis      common.AnalysisData `json:"-" gorm:"type:jsonb"`
	CreatedAt     time.Time           `json:"createdAt" gorm:"index"`
	UpdatedAt     time.Time           `json:"updatedAt"`
}

func (Software) AfterCreate added in v0.3.0

func (s Software) AfterCreate(trx *gorm.DB) error

func (Software) AfterDelete added in v0.3.0

func (s Software) AfterDelete(trx *gorm.DB) error

func (Software) AfterUpdate added in v0.3.0

func (s Software) AfterUpdate(trx *gorm.DB) error

func (Software) TableName

func (Software) TableName() string

func (Software) UUID added in v0.3.0

func (s Software) UUID() string

type SoftwareURL

type SoftwareURL struct {
	ID         string    `gorm:"primarykey"`
	URL        string    `gorm:"uniqueIndex"`
	SoftwareID string    `gorm:"not null"`
	CreatedAt  time.Time `gorm:"index"`
	UpdatedAt  time.Time
}

func (SoftwareURL) MarshalJSON

func (su SoftwareURL) MarshalJSON() ([]byte, error)

func (*SoftwareURL) UnmarshalJSON added in v0.9.0

func (su *SoftwareURL) UnmarshalJSON(data []byte) error

type SoftwareURLSlice added in v0.11.0

type SoftwareURLSlice []SoftwareURL

func (SoftwareURLSlice) MarshalJSON added in v0.11.0

func (slice SoftwareURLSlice) MarshalJSON() ([]byte, error)

func (*SoftwareURLSlice) UnmarshalJSON added in v0.11.0

func (slice *SoftwareURLSlice) UnmarshalJSON(data []byte) error

type Webhook added in v0.3.0

type Webhook struct {
	ID        string    `json:"id" gorm:"primaryKey"`
	URL       string    `json:"url" gorm:"index:idx_webhook_url,unique"`
	Secret    string    `json:"-"`
	CreatedAt time.Time `json:"createdAt" gorm:"index"`
	UpdatedAt time.Time `json:"updatedAt"`

	// Entity this Webhook is for (fe. Publisher, Software, etc.)
	EntityID   string `json:"-" gorm:"index:idx_webhook_url,unique"`
	EntityType string `json:"-" gorm:"index:idx_webhook_url,unique"`
}

Jump to

Keyboard shortcuts

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