index

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 13, 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 DB

type DB struct {
	// contains filtered or unexported fields
}

func New

func New(dsn string, autoMigrate bool) (*DB, error)

func (*DB) AutoMigrate

func (db *DB) AutoMigrate() error

func (*DB) Check

func (db *DB) Check(w http.ResponseWriter, _ *http.Request)

func (*DB) Close

func (db *DB) Close() error

func (*DB) WithContext

func (db *DB) WithContext(ctx context.Context) *gorm.DB

type Dataset

type Dataset struct {
	ID             string `gorm:"primaryKey" json:"id"`
	EmbedDimension int    `json:"embed_dim,omitempty"`
	Files          []File `gorm:"foreignKey:Dataset;references:ID;constraint:OnDelete:CASCADE;"`
}

Dataset refers to a VectorDB data space. @Description Dataset refers to a VectorDB data space.

func GetDataset

func GetDataset(db *gorm.DB, id string) (*Dataset, error)

type Document

type Document struct {
	ID      string `gorm:"primaryKey" json:"id"`
	Dataset string `gorm:"primaryKey" json:"dataset"` // Foreign key to Dataset, part of composite primary key with FileID
	FileID  string `gorm:"primaryKey" json:"file_id"` // Foreign key to File, part of composite primary key with Dataset
}

type File

type File struct {
	ID        string     `gorm:"primaryKey" json:"id"`
	Dataset   string     `gorm:"primaryKey" json:"dataset"` // Foreign key to Dataset
	Documents []Document `gorm:"foreignKey:FileID,Dataset;references:ID,Dataset;constraint:OnDelete:CASCADE;"`
	// File metadata, commonly used for deduplication
	FileMetadata `json:",inline"`
}

type FileMetadata

type FileMetadata struct {
	Name         string    `json:"name"`
	AbsolutePath string    `json:"absolute_path"`
	Size         int64     `json:"size"`
	ModifiedAt   time.Time `json:"modified_at"`
}

Jump to

Keyboard shortcuts

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