filestore

package
v0.4.59 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 19 Imported by: 0

README

filestore

An implementation of a store that persist and retrieves DataTug projects.

Documentation

Index

Constants

View Source
const (
	BoardsFolder           = "boards"
	ProjectSummaryFileName = "datatug-project.json"
	DataFolder             = "data"
	DatatugFolder          = "datatug"
	DbFolder               = "db"
	DbCatalogsFolder       = "catalogs"
	DbModelsFolder         = "dbmodels"
	EntitiesFolder         = "entities"
	EnvironmentsFolder     = "environments"
	QueriesFolder          = "queries"
	RecordsetsFolder       = "recordsets"
	ServersFolder          = "servers"
	SchemasFolder          = "schemas"
	TablesFolder           = "tables"
	ViewsFolder            = "views"
)

DatatugFolder defines a folder name in a repo where to storage DataTug project

Variables

This section is empty.

Functions

func GetProjectPath

func GetProjectPath(id string) string

GetProjectPath gets project projDirPath

func LoadProjectFile

func LoadProjectFile(projPath string) (v models.ProjectFile, err error)

LoadProjectFile loads project file

func NewSingleProjectLoader

func NewSingleProjectLoader(path string) (loader storage.ProjectStore, projectID string)

NewSingleProjectLoader create new single project loader

func NewStore

func NewStore(id string, pathsByID map[string]string) (fsStore storage.Store, err error)

NewStore create a storage for multiple projects by their dir paths

func SetProjectPath

func SetProjectPath(id, path string)

SetProjectPath sets project projDirPath

Types

type DbCatalogFile

type DbCatalogFile struct {
	Driver  string `json:"driver"` // It's excessive but good to have for validation
	Path    string `json:"path,omitempty"`
	DbModel string `json:"dbmodel,omitempty"`
}

DbCatalogFile defines metadata to be stored in a JSON file in the db folder

func (DbCatalogFile) Validate

func (v DbCatalogFile) Validate() error

Validate returns error if not valid

type DbModelFile

type DbModelFile struct {
	models.ProjectItem
	Environments models.DbModelEnvironments `json:"environments,omitempty"`
}

DbModelFile defines what to storage to dbmodel file

func (DbModelFile) Validate

func (v DbModelFile) Validate() error

Validate returns error if not valid

type Decoder

type Decoder interface {
	Decode(o interface{}) error
}

Decoder decodes

type FsStore added in v0.3.0

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

FsStore provides implementation of file system storage

func NewSingleProjectStore

func NewSingleProjectStore(projectPath, projectID string) (storeInterface *FsStore, projID string)

NewSingleProjectStore creates an instance of storage that implements storage.Store for a single project

func (FsStore) CreateProject added in v0.3.0

func (store FsStore) CreateProject(_ context.Context, _ dto.CreateProjectRequest) (*models.ProjectSummary, error)

func (FsStore) DeleteProject added in v0.3.0

func (store FsStore) DeleteProject(_ context.Context, id string) error

func (FsStore) GetFolderPath added in v0.3.0

func (loader FsStore) GetFolderPath(projectID string, folder ...string) (folderPath string, err error)

func (FsStore) GetProjectPath added in v0.3.0

func (loader FsStore) GetProjectPath(projectID string) (projID string, projPath string, err error)

GetProjectPath returns project projDirPath by project ID

func (FsStore) GetProjectStore added in v0.3.0

func (store FsStore) GetProjectStore(id string) storage.ProjectStore

func (FsStore) GetProjects added in v0.3.0

func (store FsStore) GetProjects(context.Context) (projectBriefs []models.ProjectBrief, err error)

GetProjects returns list of projects

func (FsStore) LoadRecordsetData added in v0.3.0

func (loader FsStore) LoadRecordsetData(projectID, datasetName, fileName string) (*models.Recordset, error)

LoadRecordsetData loads recordset data

func (FsStore) LoadRecordsetDefinition added in v0.3.0

func (loader FsStore) LoadRecordsetDefinition(projectID, recordsetID string) (dataset *models.RecordsetDefinition, err error)

LoadRecordsetDefinition loads recordset definition

func (FsStore) LoadRecordsetDefinitions added in v0.3.0

func (loader FsStore) LoadRecordsetDefinitions(projectID string) (recordsetDefs []*models.RecordsetDefinition, err error)

LoadRecordsetDefinitions returns flat list of recordsets that might be stored in a tree structure directories

type ProjDbServerFile

type ProjDbServerFile struct {
	models.ProjectItem
}

ProjDbServerFile stores info about project DB server

type TableColumnsFile

type TableColumnsFile struct {
	models.TableKey
	Columns []*models.TableColumn `json:"columns,omitempty"`
}

TableColumnsFile info to be stored about column in a JSON file

type TableFile

type TableFile struct {
	models.TableProps
	PrimaryKey   *models.UniqueKey           `json:"primaryKey,omitempty"`
	ForeignKeys  []*models.ForeignKey        `json:"foreignKeys,omitempty"`
	ReferencedBy []*models.TableReferencedBy `json:"referencedBy,omitempty"`
	Columns      []*models.TableColumn       `json:"columns,omitempty"`
	Indexes      []*models.Index             `json:"indexes,omitempty"`
}

TableFile hold summary on table or view

type TableForeignKeysFile

type TableForeignKeysFile struct {
	models.TableKey
	ForeignKeys []*models.ForeignKey `json:"foreignKeys"`
}

TableForeignKeysFile info to be stored about FK in a JSON file

type TableModelColumnsFile

type TableModelColumnsFile struct {
	Columns models.ColumnModels `json:"columns,omitempty"`
}

TableModelColumnsFile info to be stored about column in a JSON file

func (TableModelColumnsFile) Validate

func (v TableModelColumnsFile) Validate() error

Validate returns error if not valid

type TableModelFile

type TableModelFile struct {
	models.TableKey
}

TableModelFile defines what to storage in table model file

type TablePrimaryKeyFile

type TablePrimaryKeyFile struct {
	models.TableKey
	PrimaryKey *models.UniqueKey `json:"primaryKey"`
}

TablePrimaryKeyFile info to be stored about PK in a JSON file

type TablePropsFile

type TablePropsFile struct {
	models.TableKey
	models.TableProps
}

TablePropsFile info to be stored about table in a JSON file

type TableRefsByFile

type TableRefsByFile struct {
	models.TableKey
	ReferencedBy []*models.TableReferencedBy `json:"referencedBy"`
}

TableRefsByFile info to be stored about reference in a JSON file

Jump to

Keyboard shortcuts

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