db

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package db defines database models for Result data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotations

type Annotations map[string]string

Annotations is a custom-defined type of a gorm model field.

func (*Annotations) Scan

func (ann *Annotations) Scan(value interface{}) error

Scan resolves serialized data read from database into an Annotation. This implements the sql.Scanner interface.

func (Annotations) Value

func (ann Annotations) Value() (driver.Value, error)

Value returns the value of Annotations for database driver. This implements driver.Valuer. gorm uses this function to convert a database model's Annotation field into a type that gorm driver can write into the database.

type Record

type Record struct {
	// Result is used to create the relationship between the Result and Records
	// table. Data will not be returned here during reads. Use the foreign key
	// fields instead.
	Result     Result `gorm:"foreignKey:Parent,ResultID;references:Parent,ID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	Parent     string `gorm:"primaryKey;uniqueIndex:records_by_name,priority:1;size:64;"`
	ResultID   string `gorm:"primaryKey;size:64;"`
	ResultName string `gorm:"uniqueIndex:records_by_name,priority:2;size:64;"`

	ID   string `gorm:"primaryKey;size:64;"`
	Name string `gorm:"index:records_by_name,priority:3;size:64;"`

	// Napkin Math (with a bit of buffer): 256 (DNS Subdomain) * 3 (Group +
	// Version + Kind).
	Type string `gorm:"size:768;"`
	Data []byte `gorm:"type:jsonb;"`

	CreatedTime time.Time `gorm:"default:current_timestamp;"`
	UpdatedTime time.Time `gorm:"default:current_timestamp;"`

	Etag string `gorm:"size:128;"`
}

Record is the database model of a Record

type RecordSummary added in v0.5.0

type RecordSummary struct {
	Record string `gorm:"size:256;"`
	// Napkin Math (with a bit of buffer): 256 (DNS Subdomain) * 3 (Group +
	// Version + Kind).
	Type        string `gorm:"size:768;"`
	StartTime   *time.Time
	EndTime     *time.Time
	Status      int32
	Annotations Annotations `gorm:"type:jsonb;"`
}

RecordSummary is the database model of a Result.RecordSummary.

type Result

type Result struct {
	Parent      string      `gorm:"primaryKey;uniqueIndex:results_by_name,priority:1;size:64;"`
	ID          string      `gorm:"primaryKey;size:64;"`
	Name        string      `gorm:"uniqueIndex:results_by_name,priority:2;size:64;"`
	Annotations Annotations `gorm:"type:jsonb;"`

	CreatedTime time.Time `gorm:"default:current_timestamp;"`
	UpdatedTime time.Time `gorm:"default:current_timestamp;"`

	Summary RecordSummary `gorm:"embedded;embeddedPrefix:recordsummary_;"`

	Etag string `gorm:"size:128;"`
}

Result is the database model of a Result.

func (Result) String

func (r Result) String() string

Directories

Path Synopsis
sqlite
Package sqlite provides sqlite-specific error checking.
Package sqlite provides sqlite-specific error checking.

Jump to

Keyboard shortcuts

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