filestore

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: MIT Imports: 20 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 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 NewStore

func NewStore(id string, pathsByID map[string]string) (fsStore *fsStore, 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 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