store

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	gorm.Model

	FileID string `gorm:"uniqueIndex"`

	TenantID       string `gorm:"index"`
	OrganizationID string
	ProjectID      string `gorm:"index"`

	Filename string
	Purpose  string

	Bytes int64

	ObjectStorePath string
}

File represents a file.

type FileSpec

type FileSpec struct {
	FileID         string
	TenantID       string
	OrganizationID string
	ProjectID      string

	Filename string
	Purpose  string
	Bytes    int64

	ObjectStorePath string
}

FileSpec is a spec of the file

type S

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

S represents the data store.

func New

func New(db *gorm.DB) *S

New creates a new store instance.

func NewTest

func NewTest(t *testing.T) (*S, func())

NewTest returns a new test store.

func (*S) AutoMigrate

func (s *S) AutoMigrate() error

AutoMigrate sets up the auto-migration task of the database.

func (*S) CreateFile

func (s *S) CreateFile(spec FileSpec) (*File, error)

CreateFile creates a file.

func (*S) DeleteFile

func (s *S) DeleteFile(fileID, projectID string) error

DeleteFile deletes a file by file ID and project ID.

func (*S) GetFile

func (s *S) GetFile(fileID, projectID string) (*File, error)

GetFile returns a file by file ID and projectID

func (*S) GetFileByFileID

func (s *S) GetFileByFileID(fileID string) (*File, error)

GetFileByFileID returns a file by file ID.

func (*S) GetFileByFileIDAndTenantID

func (s *S) GetFileByFileIDAndTenantID(fileID, tenantID string) (*File, error)

GetFileByFileIDAndTenantID returns a file by file ID and a tenant ID.

func (*S) ListFilesByProjectID

func (s *S) ListFilesByProjectID(projectID string) ([]*File, error)

ListFilesByProjectID lists files.

func (*S) ListFilesByProjectIDAndPurpose

func (s *S) ListFilesByProjectIDAndPurpose(projectID, purpose string) ([]*File, error)

ListFilesByProjectIDAndPurpose list files.

Jump to

Keyboard shortcuts

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