scheme

package
v0.12.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Tables = []any{
	&Build{},
	&Connection{},
	&Deployment{},
	&Event{},
	&Org{},
	&OrgMember{},
	&Ownership{},
	&Project{},
	&Secret{},
	&Session{},
	&SessionCallAttempt{},
	&SessionCallSpec{},
	&SessionLogRecord{},
	&Signal{},
	&Trigger{},
	&User{},
	&Value{},
	&Var{},
}

Functions

func ParseBuild

func ParseBuild(b Build) (sdktypes.Build, error)

func ParseConnection

func ParseConnection(c Connection) (sdktypes.Connection, error)

func ParseDeployment

func ParseDeployment(d Deployment) (sdktypes.Deployment, error)

func ParseDeploymentWithSessionStats

func ParseDeploymentWithSessionStats(d DeploymentWithStats) (sdktypes.Deployment, error)

func ParseEvent

func ParseEvent(e Event) (sdktypes.Event, error)

func ParseOrg added in v0.12.1

func ParseOrg(r Org) (sdktypes.Org, error)

func ParseProject

func ParseProject(r Project) (sdktypes.Project, error)

func ParseSession

func ParseSession(s Session) (sdktypes.Session, error)

func ParseSessionCallAttemptComplete

func ParseSessionCallAttemptComplete(c SessionCallAttempt) (d sdktypes.SessionCallAttemptComplete, err error)

func ParseSessionCallAttemptStart

func ParseSessionCallAttemptStart(c SessionCallAttempt) (d sdktypes.SessionCallAttemptStart, err error)

func ParseSessionCallSpec

func ParseSessionCallSpec(c SessionCallSpec) (spec sdktypes.SessionCallSpec, err error)

func ParseSessionLogRecord

func ParseSessionLogRecord(c SessionLogRecord) (spec sdktypes.SessionLogRecord, err error)

func ParseSignal added in v0.9.2

func ParseSignal(r *Signal) (*types.Signal, error)

func ParseTrigger

func ParseTrigger(e Trigger) (sdktypes.Trigger, error)

func ParseUser added in v0.10.13

func ParseUser(r User) (sdktypes.User, error)

Types

type Base added in v0.12.1

type Base struct {
	CreatedBy uuid.UUID `gorm:"type:uuid"` // TODO(authz-migration): not null
	CreatedAt time.Time
}

Embed this to the model to add base capabilities.

type Build

type Build struct {
	Base

	ProjectID uuid.UUID `gorm:"index;type:uuid;not null"`
	BuildID   uuid.UUID `gorm:"primaryKey;type:uuid;not null"`
	Data      []byte

	DeletedAt gorm.DeletedAt `gorm:"index"`

	// enforce foreign keys
	Project *Project
}

func (Build) IDFieldName added in v0.12.1

func (Build) IDFieldName() string

type Connection

type Connection struct {
	Base

	ProjectID uuid.UUID `gorm:"index;type:uuid;not null"`

	ConnectionID  uuid.UUID  `gorm:"primaryKey;type:uuid;not null"`
	IntegrationID *uuid.UUID `gorm:"index;type:uuid"`
	Name          string
	StatusCode    int32 `gorm:"index"`
	StatusMessage string

	UpdatedBy uuid.UUID `gorm:"type:uuid"`
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	Project *Project
}

func (Connection) IDFieldName added in v0.12.1

func (Connection) IDFieldName() string

type Deployment

type Deployment struct {
	Base

	ProjectID    uuid.UUID `gorm:"index;type:uuid;not null"`
	DeploymentID uuid.UUID `gorm:"primaryKey;type:uuid;not null"`
	BuildID      uuid.UUID `gorm:"type:uuid;not null"`
	State        int32

	UpdatedBy uuid.UUID `gorm:"type:uuid"`
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	// enforce foreign keys
	Build   *Build
	Project *Project
}

func (*Deployment) BeforeUpdate added in v0.9.0

func (d *Deployment) BeforeUpdate(tx *gorm.DB) (err error)

func (Deployment) IDFieldName added in v0.12.1

func (Deployment) IDFieldName() string

type DeploymentWithStats

type DeploymentWithStats struct {
	Deployment
	Created   uint32
	Running   uint32
	Error     uint32
	Completed uint32
	Stopped   uint32
}

type Event

type Event struct {
	Base

	ProjectID     uuid.UUID  `gorm:"index;type:uuid"` // TODO(authz-migration): not null.
	EventID       uuid.UUID  `gorm:"uniqueIndex;type:uuid;not null"`
	DestinationID uuid.UUID  `gorm:"index;type:uuid;not null"`
	IntegrationID *uuid.UUID `gorm:"index;type:uuid"`
	ConnectionID  *uuid.UUID `gorm:"index;type:uuid"`
	TriggerID     *uuid.UUID `gorm:"index;type:uuid"`

	EventType string `gorm:"index:idx_event_type_seq,priority:1;index:idx_event_type"`
	Data      datatypes.JSON
	Memo      datatypes.JSON
	Seq       uint64 `gorm:"primaryKey;autoIncrement:true,index:idx_event_type_seq,priority:2"`

	// enforce foreign keys
	Connection *Connection
	Trigger    *Trigger

	DeletedAt gorm.DeletedAt `gorm:"index"`

	Project *Project
}

func (Event) IDFieldName added in v0.12.1

func (Event) IDFieldName() string

type Org added in v0.12.1

type Org struct {
	Base

	OrgID       uuid.UUID `gorm:"primaryKey;type:uuid;not null"`
	DisplayName string

	UpdatedBy uuid.UUID `gorm:"type:uuid"`
	UpdatedAt time.Time
}

type OrgMember added in v0.12.1

type OrgMember struct {
	Base

	OrgID  uuid.UUID `gorm:"primaryKey;type:uuid;not null"`
	UserID uuid.UUID `gorm:"primaryKey;type:uuid;not null"`

	Org  *Org
	User *User
}

type Ownership added in v0.8.0

type Ownership struct {
	EntityID   uuid.UUID `gorm:"primaryKey;type:uuid;not null"`
	EntityType string    `gorm:"not null"`

	UserID string `gorm:"not null"`
}

TODO: Remove after migration to new ownership is done.

type Project

type Project struct {
	Base

	ProjectID uuid.UUID `gorm:"primaryKey;type:uuid;not null"`
	OrgID     uuid.UUID `gorm:"index;type:uuid"` // TODO(authz-migration): not null.
	Name      string    `gorm:"index;not null"`
	RootURL   string
	Resources []byte

	UpdatedBy uuid.UUID `gorm:"type:uuid"`
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

func (Project) IDFieldName added in v0.12.1

func (Project) IDFieldName() string

type Secret added in v0.3.1

type Secret struct {
	Key   string `gorm:"primaryKey"`
	Value string `gorm:"type:string"`
}

Secret is a database table that simply stores sensitive key-value pairs, for usage by the "db" mode of autokitteh's secrets manager. WARNING: This is not secure in any way, and not durable by default. It is intended only for temporary, local, non-production purposes.

type Session

type Session struct {
	Base

	ProjectID        uuid.UUID  `gorm:"index;type:uuid;not null"`
	SessionID        uuid.UUID  `gorm:"primaryKey;type:uuid;not null"`
	BuildID          uuid.UUID  `gorm:"index;type:uuid;not null"`
	DeploymentID     *uuid.UUID `gorm:"index;type:uuid"`
	EventID          *uuid.UUID `gorm:"index;type:uuid"`
	CurrentStateType int        `gorm:"index"`
	Entrypoint       string
	Inputs           datatypes.JSON
	Memo             datatypes.JSON

	UpdatedBy uuid.UUID `gorm:"type:uuid"`
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	// enforce foreign keys
	Build      *Build
	Deployment *Deployment
	Project    *Project
	Event      *Event `gorm:"references:EventID"`
}

func (Session) IDFieldName added in v0.12.1

func (Session) IDFieldName() string

type SessionCallAttempt

type SessionCallAttempt struct {
	SessionID uuid.UUID `gorm:"uniqueIndex:idx_session_id_seq_attempt,priority:1;type:uuid;not null"`
	Seq       uint32    `gorm:"uniqueIndex:idx_session_id_seq_attempt,priority:2"`
	Attempt   uint32    `gorm:"uniqueIndex:idx_session_id_seq_attempt,priority:3"`
	Start     datatypes.JSON
	Complete  datatypes.JSON

	// enforce foreign keys
	Session *Session
}

type SessionCallSpec

type SessionCallSpec struct {
	SessionID uuid.UUID `gorm:"primaryKey:SessionID;type:uuid;not null"`
	Seq       uint32    `gorm:"primaryKey"`
	Data      datatypes.JSON

	// enforce foreign keys
	Session *Session
}

type SessionLogRecord

type SessionLogRecord struct {
	SessionID uuid.UUID `gorm:"primaryKey:SessionID;type:uuid;not null"`
	Seq       uint64    `gorm:"primaryKey;not null"`
	Data      datatypes.JSON
	Type      string `gorm:"index"`

	// enforce foreign keys
	Session *Session
}

type Signal

type Signal struct {
	SignalID      uuid.UUID  `gorm:"primaryKey;type:uuid;not null"`
	DestinationID uuid.UUID  `gorm:"index;type:uuid;not null"`
	ConnectionID  *uuid.UUID `gorm:"type:uuid"`
	TriggerID     *uuid.UUID `gorm:"type:uuid"`
	CreatedAt     time.Time
	WorkflowID    string
	Filter        string

	// enforce foreign key
	Connection *Connection
	Trigger    *Trigger
}

type Trigger

type Trigger struct {
	Base

	ProjectID    uuid.UUID  `gorm:"index;type:uuid;not null"`
	TriggerID    uuid.UUID  `gorm:"primaryKey;type:uuid;not null"`
	ConnectionID *uuid.UUID `gorm:"index;type:uuid"`

	SourceType   string `gorm:"index"`
	EventType    string
	Filter       string
	CodeLocation string

	Name string
	// Makes sure name is unique - this is the project_id with name.
	UniqueName string `gorm:"uniqueIndex;not null"` // project_id + name

	WebhookSlug string `gorm:"index"`
	Schedule    string

	UpdatedBy uuid.UUID `gorm:"type:uuid"`
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`

	// enforce foreign keys
	Connection *Connection
	Project    *Project
}

func (Trigger) IDFieldName added in v0.12.1

func (Trigger) IDFieldName() string

type User added in v0.8.0

type User struct {
	Base

	UserID       uuid.UUID `gorm:"primaryKey;type:uuid;not null"`
	Email        string    `gorm:"uniqueIndex;not null"`
	DisplayName  string
	Disabled     bool
	DefaultOrgID uuid.UUID `gorm:"type:uuid"`

	UpdatedBy uuid.UUID `gorm:"type:uuid"`
	UpdatedAt time.Time
}

type Value added in v0.10.12

type Value struct {
	Base

	ProjectID uuid.UUID `gorm:"index;type:uuid;not null"`
	Key       string    `gorm:"primaryKey;not null"`
	Value     []byte

	UpdatedBy uuid.UUID `gorm:"type:uuid"`
	UpdatedAt time.Time

	Project *Project
}

type Var added in v0.5.0

type Var struct {
	Base

	// varID is scopeID. just mapped directly for reusing the join code
	VarID         uuid.UUID `gorm:"primaryKey;index;type:uuid;not null"`
	ScopeID       uuid.UUID `gorm:"-"`
	Name          string    `gorm:"primaryKey;index;not null"`
	Value         string
	IsSecret      bool
	IntegrationID uuid.UUID `gorm:"index;type:uuid"` // var lookup by integration id

	UpdatedBy uuid.UUID `gorm:"type:uuid"`
	UpdatedAt time.Time
}

func (*Var) AfterFind added in v0.8.0

func (v *Var) AfterFind(tx *gorm.DB) (err error)

simple hook to populate ScopeID after retrieving a Var from the database

func (*Var) BeforeCreate added in v0.8.0

func (v *Var) BeforeCreate(tx *gorm.DB) (err error)

Jump to

Keyboard shortcuts

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