model

package
v0.0.0-...-7354109 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

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

Base contains common columns for all tables.

func (*Base) BeforeCreate

func (b *Base) BeforeCreate(tx *gorm.DB) error

BeforeCreate will set a UUID.

type Content

type Content struct {
	Base

	Type              int32 `json:"type"`
	Metadata          datatypes.JSON
	Data              string              `json:"data"`
	NormalizedContent []NormalizedContent `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
	LocatedContent    []LocatedContent    `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

type LocatedContent

type LocatedContent struct {
	Base

	Data       *string `json:"data"`
	BucketData *string `json:"bucket_data"`
	ContentID  uuid.UUID
	Content    Content `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

LocatedContent is for content that must be located in a specific place, such as a URL. For larger content, data will be set to a location in a bucket.

type NormalizedContent

type NormalizedContent struct {
	Base

	Data      string `json:"data"`
	ContentID uuid.UUID
	Content   Content `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

type ProcessedReference

type ProcessedReference struct {
	Base

	URL                 string `json:"url" gorm:"uniqueIndex"`
	Title               string `json:"title"`
	Content             string `json:"content"`
	NormalizedContent   string `json:"normalized_content"`
	ContentType         string `json:"content_type"`
	SuccessfulFetch     bool   `json:"successful_fetch"`
	ReferenceEmbeddings []ReferenceEmbedding
}

type ReferenceEmbedding

type ReferenceEmbedding struct {
	gorm.Model

	ProcessedReferenceID uint
	ProcessedReference   ProcessedReference
	ContentHash          string `json:"content_hash" gorm:"uniqueIndex"`
	Embedding            string `json:"embedding"`
}

Jump to

Keyboard shortcuts

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