Documentation ¶
Index ¶
- type DB
- func (db *DB) AutoMigrate() error
- func (db *DB) Check(w http.ResponseWriter, _ *http.Request)
- func (db *DB) Close() error
- func (db *DB) ExportDatasetsToFile(ctx context.Context, path string, ids ...string) error
- func (db *DB) ImportDatasetsFromFile(ctx context.Context, path string) error
- func (db *DB) UpdateDataset(ctx context.Context, dataset Dataset) error
- func (db *DB) WithContext(ctx context.Context) *gorm.DB
- type Dataset
- type Document
- type File
- type FileMetadata
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 (*DB) AutoMigrate ¶
func (*DB) ExportDatasetsToFile ¶ added in v0.1.7
func (*DB) ImportDatasetsFromFile ¶ added in v0.1.7
func (*DB) UpdateDataset ¶ added in v0.1.8
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;"` Metadata map[string]any `json:"metadata,omitempty" gorm:"serializer:json"` }
Dataset refers to a VectorDB data space. @Description Dataset refers to a VectorDB data space.
func (*Dataset) ReplaceMetadata ¶ added in v0.1.8
ReplaceMetadata replaces the metadata of the dataset with the given metadata.
func (*Dataset) SetMetadataField ¶ added in v0.1.8
SetMetadataField sets a metadata field in the dataset. If the metadata does not exist, it will be created. If the metadata field already exists, it will be overwritten.
func (*Dataset) UpdateMetadata ¶ added in v0.1.8
UpdateMetadata updates the metadata of the dataset with the given metadata. If a metadata field already exists, it will be overwritten. If a metadata field does not exist, it will be created. Existing metadata fields that are not present in the given metadata will remain unchanged.
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"` }
Click to show internal directories.
Click to hide internal directories.