datatug

package
v0.16.5 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeString = "string"
	TypeString = "string"
	// TypeText = "text"
	TypeText = "text"
	// TypeJSON = "JSON"
	TypeJSON = "JSON"

	// TypeBit     = "bit"
	TypeBit = "bit"
	// TypeBoolean = "boolean"
	TypeBoolean = "boolean"

	// TypeNumber  = "number"
	TypeNumber = "number"
	// TypeInteger = "integer"
	TypeInteger = "integer"
	// TypeDecimal = "decimal"
	TypeDecimal = "decimal"
	// TypeFloat   = "float"
	TypeFloat = "float"
	// TypeMoney   = "money"
	TypeMoney = "money"

	// TypeDate     = "date"
	TypeDate = "date"
	// TypeDateTime = "datetime"
	TypeDateTime = "datetime"
	// TypeTime     = "time"
	TypeTime = "time"

	// TypeGUID = "GUID"
	TypeGUID = "GUID"
	// TypeUUID = "UUID"
	TypeUUID = "UUID"

	// TypeBinary = "binary"
	TypeBinary = "binary"
	// TypeImage  = "image"
	TypeImage = "image"
)
View Source
const FoldersPathSeparator = `/`

FoldersPathSeparator defines a character to be used in folders path

View Source
const MaxTagLength = 50

MaxTagLength defines maximum length of a tag = 100

View Source
const MaxTitleLength = 100

MaxTitleLength defines maximum length of a title = 100

View Source
const RootSharedFolderName = "~"

RootSharedFolderName defines name for a root shared folder

View Source
const RootUserFolderPrefix = "user:"

Variables

View Source
var ErrProjectDoesNotExist = errors.New("project does not exist")

ErrProjectDoesNotExist is an error that indicates a project does not exist

KnownTypes enumerates list of known types

Functions

func GeProjectItemByID added in v0.16.0

func GeProjectItemByID[T IProjectItem](items ProjectItems[T], id string) (t T)

func IsKnownCollectionType added in v0.14.0

func IsKnownCollectionType(v CollectionType) bool

func IsKnownQueryType added in v0.15.10

func IsKnownQueryType(queryType QueryType) bool

func IsValidateStoreType

func IsValidateStoreType(v string) bool

IsValidateStoreType checks if storage type has valid value

func ProjectDoesNotExist

func ProjectDoesNotExist(err error) bool

ProjectDoesNotExist reports if an error is a wrapper around ErrProjectDoesNotExist

func ValidateFolderPath

func ValidateFolderPath(folderPath string) error

ValidateFolderPath validates folder path

func ValidateName

func ValidateName(name string) error

ValidateName validates name

func ValidateTitle

func ValidateTitle(title string) error

ValidateTitle validates title

Types

type Action

type Action struct {
	ProjectItem
	Type string      `json:"type"`
	Data interface{} `json:"data"`
	Next Actions     `json:"next"`
}

Action does something that affects context

func (Action) Validate

func (v Action) Validate() error

Validate returns error if not valid

type Actions

type Actions ProjectItems[*Action]

Actions is slice of `Action`

func (Actions) Validate

func (v Actions) Validate() error

Validate returns error if not valid

type ApiEndpoint

type ApiEndpoint struct {
	ProjectItem

	QueryType string `json:"queryType" firestore:"queryType"` // REST, RPC, GraphQL
	Method    string `json:"method" firestore:"method"`
	UrlSchema string `json:"urlSchema" firestore:"urlSchema"`
	UrlHost   string `json:"urlHost" firestore:"urlHost"`
	UrlPath   string `json:"urlPath" firestore:"urlPath"`

	FavoritesCount int `json:"favoritesCount" firestore:"favoritesCount"`
	VotesScore     int `json:"votesScore" firestore:"votesScore"`
	VotesUp        int `json:"votesUp" firestore:"votesUp"`
	VotesDown      int `json:"votesDown" firestore:"votesDown"`
}

func (ApiEndpoint) Validate

func (v ApiEndpoint) Validate() error

type ApiService

type ApiService struct {
	ProjectItem
}

func (ApiService) Validate

func (v ApiService) Validate() error

type Board

type Board struct {
	ProjectItem
	Rows BoardRows `json:"rows,omitempty" firestore:"rows,omitempty"`
}

Board is holding all details about board

func (*Board) Validate

func (v *Board) Validate() error

Validate returns error if failed

type BoardCard

type BoardCard struct {
	ID     string       `json:"id"`
	Title  string       `json:"title"`
	Cols   int          `json:"cols,omitempty"`
	Widget *BoardWidget `json:"widget,omitempty"`
}

BoardCard describes board card

func (BoardCard) Validate

func (v BoardCard) Validate() error

Validate returns error if failed

type BoardCards

type BoardCards []BoardCard

BoardCards is slice of BoardCard

func (BoardCards) Validate

func (v BoardCards) Validate() error

Validate returns error if not valid

type BoardRow

type BoardRow struct {
	MinHeight string     `json:"minHeight,omitempty"`
	MaxHeight string     `json:"maxHeight,omitempty"`
	Cards     BoardCards `json:"cards,omitempty"`
}

BoardRow holds all details about a row in a board

func (BoardRow) Validate

func (v BoardRow) Validate() error

Validate returns error if failed

type BoardRows

type BoardRows []BoardRow

BoardRows is slice of `BoardRow`

func (BoardRows) Validate

func (v BoardRows) Validate() error

Validate returns error if failed

type BoardWidget

type BoardWidget struct {
	Name string      `json:"name"`
	Data interface{} `json:"data,omitempty"`
}

BoardWidget specifies widget. Some widgets can contain otter widgets.

func (BoardWidget) Validate

func (v BoardWidget) Validate() (err error)

Validate returns error if failed

type Boards

type Boards ProjectItems[*Board]

Boards is a slice of *Board

func (Boards) Validate

func (v Boards) Validate() error

Validate returns error if failed

type BoardsStore added in v0.15.0

type BoardsStore interface {
	LoadBoards(ctx context.Context, o ...StoreOption) (Boards, error)
	LoadBoard(ctx context.Context, id string, o ...StoreOption) (*Board, error)
	SaveBoard(ctx context.Context, board *Board) error
	DeleteBoard(ctx context.Context, id string) error
}

type CatalogObject

type CatalogObject struct {
	Type         string `json:"type"`
	Schema       string `json:"schema"`
	Name         string `json:"name"`
	DefaultAlias string `json:"defaultAlias,omitempty"`
}

CatalogObject used in list of objects

func (CatalogObject) Validate

func (v CatalogObject) Validate() error

Validate returns error if not valid

type CatalogObjectWithRefs

type CatalogObjectWithRefs struct {
	CatalogObject
	PrimaryKey   *UniqueKey    `json:"primaryKey,omitempty"`
	ForeignKeys  ForeignKeys   `json:"foreignKeys,omitempty"`
	ReferencedBy ReferencedBys `json:"referencedBy,omitempty"`
}

CatalogObjectWithRefs defines ref to catalog object

func (CatalogObjectWithRefs) Validate

func (v CatalogObjectWithRefs) Validate() error

Validate returns error if not valid

type CatalogObjects

type CatalogObjects []CatalogObject

CatalogObjects defines list of catalog objects

func (CatalogObjects) Validate

func (v CatalogObjects) Validate() error

Validate returns error if not valid

type CatalogObjectsWithRefs

type CatalogObjectsWithRefs []CatalogObjectWithRefs

CatalogObjectsWithRefs defines slice

func (CatalogObjectsWithRefs) Validate

func (v CatalogObjectsWithRefs) Validate() error

Validate returns error if not valid

type ChangeType

type ChangeType int

ChangeType defines what kind of change performed or to be performed

const (
	ChangeTypeUnchanged ChangeType = iota
	ChangeTypeAdded
	ChangeTypeAltered
	ChangeTypeDeleted
)

type Changeset

type Changeset struct {
	Status   string       `json:"status"`
	Datasets []DatasetDef `json:"datasets"`
}

Changeset holds a set of data changes to be applied

type ChangesetDef

type ChangesetDef struct {
	ProjectItem
	Datasets []ChangesetRefToDataset `json:"datasets"`
}

ChangesetDef defines a set of changes to be applied

type ChangesetRefToDataset

type ChangesetRefToDataset struct {
	ID       string `json:"id"`
	Required bool   `json:"required"`
}

ChangesetRefToDataset defines a reference to a dataset

type CharacterSet

type CharacterSet struct {
	Catalog string `json:"Catalog,omitempty"`
	Schema  string `json:"Schema,omitempty"`
	Name    string `json:"GetID"`
}

CharacterSet holds info about character set

func (CharacterSet) Validate

func (v CharacterSet) Validate() error

Validate returns error if not valid

type Check

type Check struct {
	ID    string          `json:"id"` // This a random ID uniquely identifying a specific check instance
	Title string          `json:"title,omitempty"`
	Type  string          `json:"type"`
	Data  json.RawMessage `json:"data,omitempty"`
}

Check defines a check

func (*Check) Validate

func (v *Check) Validate() error

Validate returns error if not valid

type Checks

type Checks []*Check

Checks is a slice of *Check

func (Checks) Validate

func (v Checks) Validate() error

Validate returns error if not valid

type Collation

type Collation struct {
	Catalog string `json:"catalog,omitempty"`
	Schema  string `json:"schema,omitempty"`
	Name    string `json:"name"`
}

Collation holds info about collation

func (Collation) Validate

func (v Collation) Validate() error

Validate returns error if not valid

type CollectionInfo

type CollectionInfo struct {
	DBCollectionKey
	RecordsetBaseDef
	TableProps
	DDL          string        `json:"ddl,omitempty"` // Data Definition Language
	Columns      TableColumns  `json:"columns,omitempty"`
	Indexes      []*Index      `json:"indexes,omitempty"`
	ReferencedBy ReferencedBys `json:"referencedBy,omitempty"`
	RecordsCount *int          `json:"recordsCount,omitempty"`
}

CollectionInfo holds metadata about a collection or a table or a view

func (CollectionInfo) Validate

func (v CollectionInfo) Validate() error

Validate returns error if not valid

type CollectionType added in v0.14.0

type CollectionType string
const (
	CollectionTypeAny                    = "*"
	CollectionTypeUnknown CollectionType = ""
	CollectionTypeTable   CollectionType = "table"
	CollectionTypeView    CollectionType = "view"
)

type ColumnDiff

type ColumnDiff struct {
	HitAndMiss
}

ColumnDiff holds column diffs

type ColumnInfo

type ColumnInfo struct {
	DbColumnProps
	//ChangeType ChangeType `json:"-"` // Document what it is and why needed
	//ByEnv       map[string]ColumnInfo `json:"byEnv,omitempty"`
	Constraints []string `json:"constraints,omitempty"`
}

ColumnInfo holds column metadata

func (ColumnInfo) Validate

func (v ColumnInfo) Validate() error

Validate returns error if not valid

type ColumnModel

type ColumnModel struct {
	ColumnInfo
	ByEnv  StateByEnv `json:"byEnv,omitempty"`
	Checks Checks     `json:"checks,omitempty"`
}

ColumnModel defines a column as we expect it to be

func (*ColumnModel) Validate

func (v *ColumnModel) Validate() error

Validate returns error if not valid

type ColumnModels

type ColumnModels []*ColumnModel

ColumnModels is a slice of *ColumnModel

func (ColumnModels) Validate

func (v ColumnModels) Validate() error

Validate returns error if not valid

type ColumnsDiff

type ColumnsDiff []ColumnDiff

ColumnsDiff holds list of column diffs

type Constraint

type Constraint struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

Constraint defines constraint

func (Constraint) Validate

func (v Constraint) Validate() error

Validate returns error if not valid

type Credentials

type Credentials struct {
	Username string `json:"username,omitempty" yaml:"username,omitempty"`
	Password string `json:"password,omitempty"  yaml:"password,omitempty"`
}

Credentials holds username & password

func (Credentials) Validate

func (v Credentials) Validate() error

Validate returns error if failed

type DBCollectionKey added in v0.14.2

type DBCollectionKey struct {
	Ref dal.CollectionRef
	// contains filtered or unexported fields
}

DBCollectionKey defines a key that identifies a table or a view

func NewCollectionKey added in v0.14.0

func NewCollectionKey(t CollectionType, name, schema, catalog string, parent *dal.Key) DBCollectionKey

func NewTableKey added in v0.14.0

func NewTableKey(name, schema, catalog string, parent *dal.Key) DBCollectionKey

func NewViewKey added in v0.14.0

func NewViewKey(name, schema, catalog string, parent *dal.Key) DBCollectionKey

func (DBCollectionKey) Catalog added in v0.14.2

func (v DBCollectionKey) Catalog() string

func (DBCollectionKey) Name added in v0.14.2

func (v DBCollectionKey) Name() string

func (DBCollectionKey) Schema added in v0.14.2

func (v DBCollectionKey) Schema() string

func (DBCollectionKey) String added in v0.14.2

func (v DBCollectionKey) String() string

func (DBCollectionKey) Type added in v0.14.2

func (DBCollectionKey) Validate added in v0.14.2

func (v DBCollectionKey) Validate() error

Validate returns error if not valid

type DatabaseDifferences

type DatabaseDifferences struct {
	ID          string      `json:"id"`
	SchemasDiff SchemasDiff `json:"schemasDiff"`
}

DatabaseDifferences holds DB diffs

type DatasetDef

type DatasetDef struct {
	Recordsets []RecordsetDefinition `json:"recordsets"`
}

DatasetDef is a set of recordsets

type DatasetRefToRecordset

type DatasetRefToRecordset struct {
	MinRecordsCount int `json:"minRecordsCount:omitempty"`
	MaxRecordsCount int `json:"maxRecordsCount:omitempty"`
}

DatasetRefToRecordset is a reference from dataset to recordset definition and settings specific for the dataset

type DbCatalog

type DbCatalog struct {
	DbCatalogBase
	Schemas DbSchemas
}

DbCatalog hold info about DB database

func (DbCatalog) Validate

func (v DbCatalog) Validate() error

Validate returns error if not valid

type DbCatalogBase

type DbCatalogBase struct {
	ProjectItem
	Driver  string `json:"driver"`
	Path    string `json:"path,omitempty"` // for SQLite
	DbModel string `json:"dbModel"`
}

DbCatalogBase defines base data for DB catalog

func (DbCatalogBase) Validate

func (v DbCatalogBase) Validate() error

Validate returns error if not valid

type DbCatalogCounts

type DbCatalogCounts struct {
	Schemas int `json:"schemas"`
	Tables  int `json:"tables"`
	Views   int `json:"views"`
}

DbCatalogCounts hold numbers about DB

type DbCatalogSummary

type DbCatalogSummary struct {
	DbCatalogBase
	Environments []string         `json:"environments"`
	NumberOf     *DbCatalogCounts `json:"numberOf"`
}

DbCatalogSummary holds database summary

type DbCatalogs

type DbCatalogs ProjectItems[*DbCatalog]

func (DbCatalogs) GetByID added in v0.16.0

func (v DbCatalogs) GetByID(id string) (t *DbCatalog)

func (DbCatalogs) GetTable

func (v DbCatalogs) GetTable(catalog, schema, name string) *CollectionInfo

GetTable returns table

func (DbCatalogs) IDs added in v0.16.0

func (v DbCatalogs) IDs() []string

func (DbCatalogs) Validate

func (v DbCatalogs) Validate() error

type DbCatalogsStore added in v0.16.0

type DbCatalogsStore interface {
	Server() ServerRef
	LoadDbCatalogs(ctx context.Context, o ...StoreOption) (DbCatalogs, error)
	SaveDbCatalog(ctx context.Context, dbCatalog *DbCatalog) error
	DeleteDbCatalog(ctx context.Context, id string) error
}

type DbColumnProps

type DbColumnProps struct {
	Name               string        `json:"name"`
	OrdinalPosition    int           `json:"ordinalPosition"`
	PrimaryKeyPosition int           `json:"pkPosition,omitempty"`
	IsNullable         bool          `json:"isNullable"`
	DbType             string        `json:"dbType"`
	Default            *string       `json:"default,omitempty"`
	CharMaxLength      *int          `json:"charMaxLength,omitempty"`
	CharOctetLength    *int          `json:"charOctetLength,omitempty"`
	DateTimePrecision  *int          `json:"dateTimePrecision,omitempty"`
	CharacterSet       *CharacterSet `json:"characterSet,omitempty"`
	Collation          *Collation    `json:"collation,omitempty"`
}

DbColumnProps holds column metadata

func (DbColumnProps) Validate

func (v DbColumnProps) Validate() error

Validate returns error if not valid

type DbModel

type DbModel struct {
	ProjectItem
	Schemas      SchemaModels        `json:"schemas,omitempty"`
	Environments DbModelEnvironments `json:"environments,omitempty"`
}

DbModel holds a model of a database

func (DbModel) Validate

func (v DbModel) Validate() error

Validate returns error if not valid

type DbModelDbCatalog

type DbModelDbCatalog struct {
	ID string `json:"id"`
}

DbModelDbCatalog holds DB model

func (DbModelDbCatalog) Validate

func (v DbModelDbCatalog) Validate() error

Validate returns error if not valid

type DbModelDbCatalogs

type DbModelDbCatalogs []*DbModelDbCatalog

DbModelDbCatalogs slice of *DbModelDbCatalog

func (DbModelDbCatalogs) GetByID

func (v DbModelDbCatalogs) GetByID(id string) (dbModelDb *DbModelDbCatalog)

GetByID returns DbModelDbCatalog by GetID

func (DbModelDbCatalogs) Validate

func (v DbModelDbCatalogs) Validate() error

Validate returns error if not valid

type DbModelEnv

type DbModelEnv struct {
	ID         string `json:"id"` // environment ID
	DbCatalogs DbModelDbCatalogs
}

DbModelEnv holds links from db model to environments

func (DbModelEnv) Validate

func (v DbModelEnv) Validate() error

Validate returns error if not valid

type DbModelEnvironments

type DbModelEnvironments []*DbModelEnv

DbModelEnvironments slice of *DbModelEnv

func (DbModelEnvironments) GetByID

func (v DbModelEnvironments) GetByID(id string) *DbModelEnv

GetByID return *DbModelEnv by GetID

func (DbModelEnvironments) Validate

func (v DbModelEnvironments) Validate() error

Validate returns error if not valid

type DbModels

type DbModels ProjectItems[*DbModel]

DbModels is a slice of *DbModel

func (DbModels) GetByID added in v0.16.0

func (v DbModels) GetByID(id string) *DbModel

func (DbModels) IDs

func (v DbModels) IDs() []string

func (DbModels) Validate

func (v DbModels) Validate() error

Validate returns error if failed

type DbModelsStore added in v0.16.0

type DbModelsStore interface {
	LoadDbModels(ctx context.Context, o ...StoreOption) (DbModels, error)
	LoadDbModel(ctx context.Context, id string, o ...StoreOption) (*DbModel, error)
	SaveDbModel(ctx context.Context, dbModel *DbModel) error
	SaveDbModels(ctx context.Context, dbModels DbModels) error
	DeleteDbModel(ctx context.Context, id string) error
}

type DbSchema

type DbSchema struct {
	ProjectItem
	Tables []*CollectionInfo `json:"tables"`
	Views  []*CollectionInfo `json:"views"`
}

DbSchema represents a schema in a database

func (DbSchema) Validate

func (v DbSchema) Validate() error

Validate returns error if not valid

type DbSchemas

type DbSchemas ProjectItems[*DbSchema]

DbSchemas is a slice of *DbSchema

func (DbSchemas) GetByID

func (v DbSchemas) GetByID(id string) *DbSchema

GetByID returns schema by GetID

func (DbSchemas) Validate

func (v DbSchemas) Validate() error

Validate returns error if not valid

type DbSchemasStore added in v0.16.0

type DbSchemasStore interface {
	LoadDbSchemas(ctx context.Context, o ...StoreOption) (DbSchemas, error)
	LoadDbSchema(ctx context.Context, id string, o ...StoreOption) (*DbSchema, error)
	SaveDbSchema(ctx context.Context, board *DbSchema) error
	DeleteDbSchema(ctx context.Context, id string) error
}

type DiffDbRef

type DiffDbRef struct {
	Environment string `json:"env"`
	Host        string `json:"host"`
	Port        int    `json:"port,omitempty"`
	Catalog     string `json:"catalog,omitempty"`
}

DiffDbRef is a link to DB

type Entities

type Entities ProjectItems[*Entity]

Entities is a slice of *Entity

func (Entities) GetByID added in v0.16.0

func (v Entities) GetByID(id string) *Entity

func (Entities) IDs

func (v Entities) IDs() []string

func (Entities) Validate

func (v Entities) Validate() error

Validate returns error if failed

type EntitiesStore added in v0.15.7

type EntitiesStore interface {
	LoadEntities(ctx context.Context, o ...StoreOption) (Entities, error)
	LoadEntity(ctx context.Context, id string, o ...StoreOption) (*Entity, error)
	SaveEntity(ctx context.Context, entity *Entity) error
	DeleteEntity(ctx context.Context, id string) error
}

type Entity

type Entity struct {
	ProjectItem
	//ProjEntityBrief
	ListOfTags
	Fields EntityFields `json:"fields,omitempty" firestore:"fields,omitempty"`
	Tables TableKeys    `json:"tables,omitempty" firestore:"tables,omitempty"`
}

Entity hold full info about entity

func (Entity) Validate

func (v Entity) Validate() error

Validate returns error if not valid

type EntityField

type EntityField struct {
	ID           string         `json:"id" firestore:"id"`
	Type         string         `json:"type" firestore:"type"`
	Title        string         `json:"title,omitempty" firestore:"title,omitempty"`
	IsKeyField   bool           `json:"isKeyField,omitempty" firestore:"isKeyField,omitempty"`
	NamePatterns StringPatterns `json:"namePatterns" firestore:"namePattern"`
}

EntityField hold info about entity field

func (EntityField) Validate

func (v EntityField) Validate() error

Validate returns error if not valid

type EntityFieldRef

type EntityFieldRef struct {
	Entity string `json:"entity"`
	Field  string `json:"field"`
}

EntityFieldRef holds reference to entity field

func (EntityFieldRef) Validate

func (v EntityFieldRef) Validate() error

Validate returns error if not valid

type EntityFields

type EntityFields []*EntityField

EntityFields is a slice of EntityField

func (EntityFields) Validate

func (v EntityFields) Validate() error

Validate returns error if not valid

type EnvDb

type EnvDb struct {
	ProjectItem
	DbModel string    `json:"dbModel"`
	Server  ServerRef `json:"server"`
}

EnvDb hold info about DB in specific environment

func (EnvDb) Validate

func (v EnvDb) Validate() error

Validate returns error if not valid

type EnvDbCatalogStore added in v0.15.7

type EnvDbCatalogStore interface {
	LoadEnvDbCatalogs(ctx context.Context, envID string, o ...StoreOption) (DbCatalogs, error)
	LoadEnvDbCatalog(ctx context.Context, envID, serverID, catalogID string, o ...StoreOption) (DbCatalog, error)
	SaveEnvDbCatalog(ctx context.Context, envID, serverID, catalogID string, catalogs *DbCatalog) error
	SaveEnvDbCatalogs(ctx context.Context, envID, serverID, catalogID string, catalogs DbCatalogs) error
	DeleteEnvDbCatalog(ctx context.Context, envID, serverID, catalogID string) error
}

type EnvDbDifference

type EnvDbDifference struct {
	Property    string
	ActualValue string
}

EnvDbDifference hold diffs for a DB in specific environment

type EnvDbServer

type EnvDbServer struct {
	ServerRef
	Catalogs []string `json:"catalogs,omitempty"`
}

EnvDbServer holds information about DB server in an environment

func (*EnvDbServer) GetID added in v0.15.7

func (v *EnvDbServer) GetID() string

func (*EnvDbServer) SetID added in v0.15.7

func (v *EnvDbServer) SetID(id string)

func (*EnvDbServer) Validate

func (v *EnvDbServer) Validate() error

Validate returns error if no valid

type EnvDbServers

type EnvDbServers []*EnvDbServer

EnvDbServers is a slice of *EnvDbServer

func (EnvDbServers) GetByServerRef

func (v EnvDbServers) GetByServerRef(serverRef ServerRef) *EnvDbServer

GetByServerRef returns *EnvDbServer by GetID

func (EnvDbServers) Validate

func (v EnvDbServers) Validate() error

Validate returns error of failed

type EnvDbServersStore added in v0.15.7

type EnvDbServersStore interface {
	LoadEnvDbServers(ctx context.Context, envID string, o ...StoreOption) (EnvDbServers, error)
	LoadEnvDbServer(ctx context.Context, envID, serverID string, o ...StoreOption) (*EnvDbServer, error)
	SaveEnvDbServer(ctx context.Context, envID string, server *EnvDbServer) error
	SaveEnvServers(ctx context.Context, envID string, servers EnvDbServers) error
	DeleteEnvDbServer(ctx context.Context, envID, serverID string) error
}

type EnvState

type EnvState struct {
	Status      string            `json:"status"` // Possible values: exists, missing
	Differences []EnvDbDifference `json:"differences,omitempty"`
}

EnvState hold state of env

func (EnvState) Validate

func (v EnvState) Validate() error

Validate returns error if not valid

type Environment

type Environment struct {
	ProjectItem
	DbServers EnvDbServers `json:"dbServers"`
}

Environment holds information about environment

func (Environment) Validate

func (v Environment) Validate() error

Validate returns error if failed

type EnvironmentFile

type EnvironmentFile struct {
	ID string `json:"id"`
}

EnvironmentFile some file to be documented

func (EnvironmentFile) Validate

func (v EnvironmentFile) Validate() error

Validate returns error if not valid

type EnvironmentSummary

type EnvironmentSummary struct {
	ProjectItem
	Servers EnvDbServers `json:"dbServers,omitempty"`
}

EnvironmentSummary holds environment summary

func (EnvironmentSummary) Validate

func (v EnvironmentSummary) Validate() error

Validate returns error if not valid

type Environments

type Environments ProjectItems[*Environment]

Environments is a slice of pointers to Environment

func (Environments) GetByID added in v0.16.0

func (v Environments) GetByID(id string) *Environment

func (Environments) IDs added in v0.16.0

func (v Environments) IDs() []string

func (Environments) Validate

func (v Environments) Validate() error

Validate returns error if failed

type EnvironmentsStore added in v0.15.7

type EnvironmentsStore interface {
	LoadEnvironments(ctx context.Context, o ...StoreOption) (Environments, error)
	LoadEnvironment(ctx context.Context, id string, o ...StoreOption) (*Environment, error)
	LoadEnvironmentSummary(ctx context.Context, id string) (*EnvironmentSummary, error)
	SaveEnvironment(ctx context.Context, env *Environment) error
	SaveEnvironments(ctx context.Context, envs Environments) error
	DeleteEnvironment(ctx context.Context, id string) error
}

type Folder

type Folder struct {
	Name string `json:"name,omitempty" firestore:"name,omitempty"` // empty for root folders
	Note string `json:"note,omitempty" firestore:"note,omitempty"`
	// NumberOf keeps count of all successor objects in all sub-folders
	NumberOf map[string]int `json:"numberOf,omitempty" firestore:"numberOf,omitempty"`
}

Folder keeps info about folder

func (*Folder) GetID added in v0.15.7

func (v *Folder) GetID() string

func (*Folder) SetID added in v0.15.7

func (v *Folder) SetID(id string)

func (*Folder) Validate

func (v *Folder) Validate() error

Validate returns error if failed

type FolderBrief

type FolderBrief struct {
	Title string `json:"title" firestore:"title"`
}

FolderBrief holds brief about a folder item

func (FolderBrief) Validate

func (v FolderBrief) Validate() error

Validate returns error if not valid

type FolderItem

type FolderItem struct {
	ID    string `json:"id" firestore:"id"`
	Title string `json:"title" firestore:"title"`
}

FolderItem holds info about a folder item

func (FolderItem) Validate

func (v FolderItem) Validate() error

Validate returns error if not valid

type Folders added in v0.15.7

type Folders []*Folder

type FoldersStore added in v0.15.7

type FoldersStore interface {
	LoadFolders(ctx context.Context, o ...StoreOption) (Folders, error)
	LoadFolder(ctx context.Context, id string, o ...StoreOption) (*Folder, error)
	SaveFolder(ctx context.Context, path string, folder *Folder) error
	SaveFolders(ctx context.Context, path string, folders Folders) error
	DeleteFolder(ctx context.Context, id string) error
}

type ForeignKey

type ForeignKey struct {
	Name        string          `json:"name"`
	Columns     []string        `json:"columns"`
	RefTable    DBCollectionKey `json:"refTable"`
	MatchOption string          `json:"matchOption,omitempty"` // Document what this?
	UpdateRule  string          `json:"updateRule,omitempty"`  // Document what this?
	DeleteRule  string          `json:"deleteRule,omitempty"`  // Document what this?
}

ForeignKey holds metadata about foreign key

func (ForeignKey) Validate

func (v ForeignKey) Validate() error

Validate returns error if not valid

type ForeignKeys

type ForeignKeys []*ForeignKey

ForeignKeys define list of foreighn keys

func (ForeignKeys) Validate

func (v ForeignKeys) Validate() error

Validate returns error if not valid

type HTTPHeaderItem

type HTTPHeaderItem struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

HTTPHeaderItem describes an HTTP header item

func (HTTPHeaderItem) Validate

func (v HTTPHeaderItem) Validate() error

Validate returns error if not valid

type HTTPHeaders

type HTTPHeaders []HTTPHeaderItem

HTTPHeaders is a []HTTPHeaderItem

func (HTTPHeaders) Validate

func (v HTTPHeaders) Validate() error

Validate returns error if not valid

type HTTPRequest

type HTTPRequest struct {
	Method             string      `json:"method"`
	URL                string      `json:"url"`
	Protocol           string      `json:"protocol,omitempty"`
	Headers            HTTPHeaders `json:"headers,omitempty"`
	TimeoutThresholdMs int         `json:"timeoutThresholdMs,omitempty"` // in milliseconds
	Parameters         Parameters  `json:"parameters,omitempty"`
	Content            string      `json:"content,omitempty"`
}

HTTPRequest describes an HTTP request

func (HTTPRequest) Validate

func (v HTTPRequest) Validate() error

Validate returns error if not valid

type HTTPWidgetDef

type HTTPWidgetDef struct {
	WidgetBase
	Request HTTPRequest `json:"request"`
}

HTTPWidgetDef holds info about a widget that makes HTTP requests

func (HTTPWidgetDef) Validate

func (v HTTPWidgetDef) Validate() error

Validate returns error if not valid

type HideRecordsetColIf

type HideRecordsetColIf struct {
	Parameters []string `json:"parameters,omitempty"`
}

HideRecordsetColIf defines recordset col if

func (HideRecordsetColIf) Validate

func (v HideRecordsetColIf) Validate() error

Validate returns error if not valid

type HitAndMiss

type HitAndMiss struct {
	IsInModel bool        `json:"isInModel"`
	ExistsIn  []DiffDbRef `json:"existsIn"` // points to DatabaseDifferences.DatabaseDiffs[]DatabaseDiff.GetID
	MissingIn []DiffDbRef `json:"missingIn"`
}

HitAndMiss stores where entity exists and where not

type IProjectItem added in v0.16.0

type IProjectItem interface {
	GetID() string
	GetProjectItem() ProjectItem
	Validate() error
}

type IProjectItems added in v0.16.0

type IProjectItems[T IProjectItem] interface {
	IDs() []string
	GetByID(id string) (t T)
	Validate() error
}

type Index

type Index struct {
	Name               string         `json:"name"`
	Type               string         `json:"type"`
	Origin             string         `json:"origin,omitempty"` // Used by SQLite
	Columns            []*IndexColumn `json:"columns"`
	IsClustered        bool           `json:"clustered,omitempty"`
	IsXML              bool           `json:"xml,omitempty"`
	IsColumnStore      bool           `json:"columnstore,omitempty"`
	IsHash             bool           `json:"hash,omitempty"`
	IsUnique           bool           `json:"unique,omitempty"`
	IsUniqueConstraint bool           `json:"uniqueConstraint,omitempty"`
	IsPrimaryKey       bool           `json:"primaryKey,omitempty"`
	IsPartial          bool           `json:"partial,omitempty"`
}

Index holds info about DB table index

func (Index) Validate

func (v Index) Validate() error

Validate returns error if not valid

type IndexColumn

type IndexColumn struct {
	Name             string `json:"name"`
	IsDescending     bool   `json:"descending,omitempty"`
	IsIncludedColumn bool   `json:"included,omitempty"`
}

IndexColumn holds info about a col in a DB table index

type Indexes

type Indexes []Index

Indexes defines slice

func (Indexes) Validate

func (v Indexes) Validate() error

Validate returns error if not valid

type Issues

type Issues struct {
	Schema []string `json:"schema,omitempty"`
}

Issues TODO: document what it is for

type ListOfTags

type ListOfTags struct {
	Tags []string `json:"tags,omitempty" firestore:"tags,omitempty"`
}

ListOfTags mixing

func (ListOfTags) Validate

func (v ListOfTags) Validate() error

Validate validates record

type OptionsValueCheck

type OptionsValueCheck struct {
	Type    string        `json:"type"`
	Options []interface{} `json:"options"`
}

OptionsValueCheck test value is matching one of the available options

func (OptionsValueCheck) Validate

func (v OptionsValueCheck) Validate() error

Validate returns error if not valid

type Parameter

type Parameter struct {
	ID    string      `json:"id"`
	Type  string      `json:"type"`
	Value interface{} `json:"value"`
}

Parameter defines parameter

type ParameterDef

type ParameterDef struct {
	ID           string           `json:"id"`
	Type         string           `json:"type"`
	Title        string           `json:"title,omitempty"`
	DefaultValue interface{}      `json:"defaultValue,omitempty"`
	IsRequired   bool             `json:"isRequired,omitempty"`
	IsMultiValue bool             `json:"isMultiValue,omitempty"`
	MaxLength    int              `json:"maxLength,omitempty"`
	MinLength    int              `json:"minLength,omitempty"`
	Meta         *EntityFieldRef  `json:"meta,omitempty"`
	Lookup       *ParameterLookup `json:"lookup,omitempty"`
}

ParameterDef defines input parameter for a board, widget, etc.

func (ParameterDef) Validate

func (v ParameterDef) Validate() error

Validate returns error if failed

type ParameterLookup

type ParameterLookup struct {
	DB        string   `json:"db" firestore:"db"`
	SQL       string   `json:"sql" firestore:"sql"`
	KeyFields []string `json:"keyFields" firestore:"keyFields"`
}

ParameterLookup holds definition for parameter lookup

type Parameters

type Parameters []ParameterDef

Parameters slice of `ParameterDef`

func (Parameters) Validate

func (v Parameters) Validate() error

Validate returns error if failed

type ProjBoardBrief

type ProjBoardBrief struct {
	ProjItemBrief
	Parameters Parameters `json:"parameters,omitempty" firestore:"parameters,omitempty"`
	// TODO: Document why and how to use, add tests
	RequiredParams [][]string `json:"requiredParams,omitempty" firestore:"requiredParams,omitempty"`
}

ProjBoardBrief defines brief information of Board

func (ProjBoardBrief) Validate

func (v ProjBoardBrief) Validate() error

type ProjDbDriver added in v0.16.0

type ProjDbDriver struct {
	ProjectItem
	Servers ProjDbServers `json:"servers"`
}

func (ProjDbDriver) Validate added in v0.16.0

func (v ProjDbDriver) Validate() error

type ProjDbDrivers added in v0.16.0

type ProjDbDrivers []*ProjDbDriver

func (ProjDbDrivers) GetByID added in v0.16.0

func (p ProjDbDrivers) GetByID(id string) *ProjDbDriver

func (ProjDbDrivers) IDs added in v0.16.0

func (p ProjDbDrivers) IDs() []string

func (ProjDbDrivers) Validate added in v0.16.0

func (p ProjDbDrivers) Validate() error

type ProjDbDriversStore added in v0.16.0

type ProjDbDriversStore interface {
	LoadProjDbDrivers(ctx context.Context, o ...StoreOption) (ProjDbDrivers, error)
	LoadProjDbDriver(ctx context.Context, id string, o ...StoreOption) (*ProjDbDriver, error)
	SaveProjDbDriver(ctx context.Context, dbDriver *ProjDbDriver, o ...StoreOption) error
	DeleteProjDbDriver(ctx context.Context, id string) error
	DbServersStore(dbDriver string) ProjDbServersStore
}

type ProjDbModelBrief

type ProjDbModelBrief struct {
	ProjectItem
	NumberOf ProjDbModelNumbers `json:"numberOf"`
}

ProjDbModelBrief hold env brief in project summary

type ProjDbModelNumbers

type ProjDbModelNumbers struct {
	Schemas int `json:"schemas"`
	Tables  int `json:"tables"`
	Views   int `json:"views"`
}

ProjDbModelNumbers holds numbers for a dbmodel

type ProjDbServer

type ProjDbServer struct {
	ProjectItem
	Server   ServerRef  `json:"server"`
	Catalogs DbCatalogs `json:"catalogs"`
}

ProjDbServer holds info about a project DB server - NOT sure if right way

func (ProjDbServer) Validate

func (v ProjDbServer) Validate() error

Validate returns error if not valid

type ProjDbServerFile

type ProjDbServerFile struct {
	ServerRef
	Catalogs []string `jsont:"catalogs,omitempty" firestore:"catalogs,omitempty"`
}

ProjDbServerFile stores summary info about ServerRef

func (ProjDbServerFile) Validate

func (v ProjDbServerFile) Validate() error

Validate returns error if not valid

type ProjDbServerSummary

type ProjDbServerSummary struct {
	ProjectItem
	DbServer ServerRef           `json:"dbServer"`
	Catalogs []*DbCatalogSummary `json:"databases,omitempty"`
}

ProjDbServerSummary holds summary info about DB server

type ProjDbServers

type ProjDbServers ProjectItems[*ProjDbServer]

ProjDbServers slice of ProjDbServer which holds ServerRef and DbCatalogs

func (ProjDbServers) GetProjDbServer

func (v ProjDbServers) GetProjDbServer(ref ServerRef) *ProjDbServer

GetProjDbServer returns db servers

func (ProjDbServers) Validate

func (v ProjDbServers) Validate() error

Validate returns error if not valid

type ProjDbServersStore added in v0.15.7

type ProjDbServersStore interface {
	DriverID() string
	CatalogsStore(serverRef ServerRef) DbCatalogsStore
	LoadProjDbServers(ctx context.Context, o ...StoreOption) (ProjDbServers, error)
	LoadProjDbServer(ctx context.Context, serverID string, o ...StoreOption) (*ProjDbServer, error)
	SaveProjDbServer(ctx context.Context, server *ProjDbServer, o ...StoreOption) error
	DeleteProjDbServer(ctx context.Context, serverID string) error
}

type ProjEntityBrief

type ProjEntityBrief struct {
	ProjItemBrief
}

ProjEntityBrief hold brief info about entity in project file

type ProjEnvBrief

type ProjEnvBrief struct {
	ProjectItem
}

ProjEnvBrief hold env brief in project summary

type ProjEnvNumbers

type ProjEnvNumbers struct {
	DbServers int `json:"dbServer"`
	Databases int `json:"databases"`
}

ProjEnvNumbers hold some numbers for environment

type ProjItemBrief

type ProjItemBrief struct {
	ID    string `json:"id,omitempty" firestore:"id,omitempty" yaml:"id,omitempty"`
	Title string `json:"title,omitempty" firestore:"title,omitempty" yaml:"title,omitempty"`
	// Document what is Folder? should it be moved somewhere?
	Folder string `json:"folder,omitempty" firestore:"folder,omitempty" yaml:"folder,omitempty"` // TODO: document purpose and usage
	ListOfTags
}

ProjItemBrief hold a brief about a project item

func (*ProjItemBrief) GetID added in v0.15.0

func (v *ProjItemBrief) GetID() string

func (*ProjItemBrief) SetID added in v0.15.0

func (v *ProjItemBrief) SetID(id string)

func (*ProjItemBrief) ValidateWithOptions added in v0.16.0

func (v *ProjItemBrief) ValidateWithOptions(isTitleRequired bool) error

ValidateWithOptions returns error if not valid

type Project

type Project struct {
	ProjectItem

	Created  *ProjectCreated `json:"created,omitempty" firestore:"created,omitempty"`
	Boards   Boards          `json:"boards,omitempty" firestore:"boards,omitempty"`
	Queries  *QueriesFolder  `json:"queries,omitempty" firestore:"queries,omitempty"`
	Entities Entities        `json:"entities,omitempty" firestore:"entities,omitempty"`

	// Use GetEnvironments to get the latest
	Environments Environments `json:"environments,omitempty" firestore:"environments,omitempty"`

	DbModels DbModels `json:"dbModels,omitempty" firestore:"dbModels,omitempty"`

	DbDrivers ProjDbDrivers `json:"dbDrivers,omitempty" firestore:"dbDrivers,omitempty"`

	Actions    Actions            `json:"actions,omitempty" firestore:"actions,omitempty"`
	Repository *ProjectRepository `json:"repository,omitempty" firestore:"repository,omitempty"`
	// contains filtered or unexported fields
}

Project holds info about a project

func NewProjectWithStore added in v0.16.5

func NewProjectWithStore(id string, store ProjectStore) (p *Project)

func NewProjectWithStoreFactory added in v0.16.5

func NewProjectWithStoreFactory(id string, newStore func(p *Project) ProjectStore) (p *Project)

func (*Project) AddProjDbServer added in v0.16.2

func (p *Project) AddProjDbServer(ctx context.Context, dbServer *ProjDbServer) (err error)

func (*Project) GetDBs added in v0.16.0

func (p *Project) GetDBs(ctx context.Context, o ...StoreOption) (dbs ProjDbDrivers, err error)

func (*Project) GetEnvironments added in v0.12.1

func (p *Project) GetEnvironments(ctx context.Context) (environments Environments, err error)

func (*Project) GetProjDbServer added in v0.16.2

func (p *Project) GetProjDbServer(ctx context.Context, serverRef ServerRef) (server *ProjDbServer, err error)

func (*Project) Validate

func (p *Project) Validate() error

Validate returns error if not valid

type ProjectBrief

type ProjectBrief struct {
	Access string `json:"access" firestore:"access"` // e.g. private, protected, public
	ProjectItem
	Repository *ProjectRepository `json:"repository,omitempty" firestore:"repository,omitempty"`
}

ProjectBrief hold project brief info (e.g. for list)

func (*ProjectBrief) Validate

func (v *ProjectBrief) Validate() error

Validate returns error if not valid

type ProjectCreated

type ProjectCreated struct {
	//ByName     string    `json:"byName,omitempty"`
	//ByUsername string    `json:"byUsername,omitempty"`
	At time.Time `json:"at" firestore:"at"`
}

ProjectCreated hold info about when and who created

type ProjectFile

type ProjectFile struct {
	Created *ProjectCreated `json:"created,omitempty" firestore:"created,omitempty"`
	ProjectItem
	Repository *ProjectRepository `json:"repository,omitempty" firestore:"repository,omitempty"`
}

ProjectFile defines what to storage to project file

func (ProjectFile) Validate

func (v ProjectFile) Validate() error

Validate returns error if not valid

type ProjectItem

type ProjectItem struct {
	ProjItemBrief
	UserIDs []string `json:"userIds,omitempty" firestore:"userIds,omitempty"`
	Access  string   `json:"access,omitempty" firestore:"access,omitempty"` // e.g. "private", "protected", "public"
}

ProjectItem base class with GetID and Name

func (ProjectItem) GetProjectItem added in v0.16.0

func (v ProjectItem) GetProjectItem() ProjectItem

func (ProjectItem) ValidateWithOptions added in v0.16.0

func (v ProjectItem) ValidateWithOptions(isTitleRequired bool) error

ValidateWithOptions returns error if not valid

type ProjectItems added in v0.16.0

type ProjectItems[T IProjectItem] []T

func (ProjectItems[T]) GetByID added in v0.16.0

func (v ProjectItems[T]) GetByID(id string) (t T)

func (ProjectItems[T]) IDs added in v0.16.0

func (v ProjectItems[T]) IDs() (ids []string)

IDs returns slice of IDs of db models

func (ProjectItems[T]) Validate added in v0.16.0

func (v ProjectItems[T]) Validate() error

type ProjectLoader added in v0.12.1

type ProjectLoader interface {
	LoadProject(ctx context.Context, projectID string) (project *Project, err error)
}

type ProjectRepository

type ProjectRepository struct {
	Type      string `json:"type"` // e.g. "git"
	WebURL    string `json:"webURL"`
	ProjectID string `json:"projectId,omitempty"`
}

ProjectRepository defines project repository

func (*ProjectRepository) Validate

func (v *ProjectRepository) Validate() error

Validate returns error if not valid

type ProjectStore added in v0.15.0

type ProjectStore interface {
	ProjectID() string
	LoadProjectFile(ctx context.Context) (ProjectFile, error)
	//LoadProjectSummary(ctx context.Context) (ProjectSummary, error)
	LoadProject(ctx context.Context, o ...StoreOption) (p *Project, err error)
	SaveProject(ctx context.Context, p *Project) error

	QueriesStore
	BoardsStore
	FoldersStore
	EntitiesStore
	EnvironmentsStore
	EnvDbServersStore
	EnvDbCatalogStore
	ProjDbDriversStore
	RecordsetDefinitionsStore
}

type ProjectSummary

type ProjectSummary struct {
	ProjectFile
	Entities []*ProjEntityBrief `json:"entities,omitempty" firestore:"entities,omitempty"`
}

ProjectSummary hold project summary - this is to be used in Firestore to minimize reads Locally we'd produce it from ProjectFile and shallow scan of nested dirs.

type ProjectVisibility added in v0.15.11

type ProjectVisibility int
const (
	PublicProject ProjectVisibility = iota
	PrivateProject
)

func (ProjectVisibility) Validate added in v0.15.11

func (v ProjectVisibility) Validate() error

type ProjectsStore added in v0.15.11

type ProjectsStore interface {
	CreateNewProject(ctx context.Context, id, title string, visibility ProjectVisibility, report StatusReporter) (project *Project, err error)
}

type PropertyDiff

type PropertyDiff struct {
	Name string `json:"name"`
	HitAndMiss
}

PropertyDiff holds diffs about some property

type QueriesFolder added in v0.16.0

type QueriesFolder struct {
	ProjectItem
	Folders QueryFolders `json:"folders,omitempty" yaml:"folders,omitempty"`
	Items   QueryDefs    `json:"items,omitempty" yaml:"items,omitempty"`
}

QueriesFolder defines folder

func (QueriesFolder) Validate added in v0.16.0

func (v QueriesFolder) Validate() error

Validate returns error if not valid

type QueriesStore added in v0.15.7

type QueriesStore interface {
	LoadQueries(ctx context.Context, folderPath string, o ...StoreOption) (folder *QueriesFolder, err error)
	LoadQuery(ctx context.Context, id string, o ...StoreOption) (*QueryDef, error)
	SaveQuery(ctx context.Context, query *QueryDefWithFolderPath) error
	DeleteQuery(ctx context.Context, id string) error
}

type QueryDef

type QueryDef struct {
	ProjectItem
	Type       QueryType        `json:"type"` // Possible value: folder, DDL, GraphQL, HTTP, etc.
	Text       string           `json:"text,omitempty" yaml:"text,omitempty"`
	Draft      bool             `json:"draft,omitempty" yaml:"draft,omitempty"`
	Parameters Parameters       `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Targets    []QueryDefTarget `json:"targets,omitempty" yaml:"targets,omitempty"`
	// User might want to now what set of cols is returned even before hitting the RUN button.
	Recordsets []RecordsetDefinition `json:"recordsets,omitempty" yaml:"recordsets,omitempty"`
}

QueryDef holds query data For HTTP request host, port, etc, are stored in Targets property,

func (QueryDef) Validate

func (v QueryDef) Validate() error

Validate returns error if not valid

type QueryDefBrief

type QueryDefBrief struct {
	ProjItemBrief
	Type  string `json:"type"` // Possible value: folder, DDL, GraphQL, etc.
	Draft bool   `json:"draft,omitempty" yaml:"draft,omitempty"`
}

func (QueryDefBrief) Validate

func (v QueryDefBrief) Validate() error

type QueryDefTarget

type QueryDefTarget struct {
	Driver   string `json:"driver,omitempty" yaml:"driver,omitempty"`
	Catalog  string `json:"catalog,omitempty" yaml:"catalog,omitempty"`
	Protocol string `json:"protocol,omitempty" yaml:"protocol,omitempty"`
	Host     string `json:"host,omitempty" yaml:"host,omitempty"`
	Port     int    `json:"port,omitempty" yaml:"port,omitempty"`
	Credentials
}

QueryDefTarget defines target of query

type QueryDefWithFolderPath

type QueryDefWithFolderPath struct {
	FolderPath string `json:"folderPath"`
	QueryDef
}

QueryDefWithFolderPath adds folder path to query definition

func (QueryDefWithFolderPath) Validate

func (v QueryDefWithFolderPath) Validate() error

Validate returns error if not valid

type QueryDefs

type QueryDefs []*QueryDef

QueryDefs defines slice

func (QueryDefs) Validate

func (v QueryDefs) Validate() error

Validate returns error if not valid

type QueryFolderBrief

type QueryFolderBrief struct {
	ProjItemBrief
	Folders []*QueryFolderBrief `json:"folders,omitempty" yaml:"folders,omitempty"`
	Items   []*QueryDefBrief    `json:"items,omitempty" yaml:"items,omitempty"`
}

QueryFolderBrief defines brief for queries folder

func (QueryFolderBrief) Validate

func (v QueryFolderBrief) Validate() error

Validate returns error if not valid

type QueryFolders

type QueryFolders []*QueriesFolder

QueryFolders defines slice

func (QueryFolders) Validate

func (v QueryFolders) Validate() error

Validate returns error if not valid

type QueryResult

type QueryResult struct {
	Created       time.Time   `json:"created"`
	EnvironmentID string      `json:"env"`
	Driver        string      `json:"driver"`
	Target        string      `json:"target"`
	Recordsets    []Recordset `json:"recordset,omitempty"`
}

QueryResult holds results of a query execution

func (QueryResult) Validate

func (v QueryResult) Validate() error

Validate returns error if not valid

type QueryType added in v0.15.7

type QueryType string
const (
	QueryTypeSQL           QueryType = "SQL"
	QueryTypeHTTP          QueryType = "HTTP"
	QueryTypeStructuredSQL QueryType = "StructuredSQL"
)

type ReadmeEncoder

type ReadmeEncoder interface {
	ProjectSummaryToReadme(w io.Writer, project Project) error
	DbServerToReadme(w io.Writer, repository *ProjectRepository, dbServer ProjDbServer) error
	TableToReadme(w io.Writer, repository *ProjectRepository, catalog string, table *CollectionInfo, dbServer ProjDbServer) error
	DbCatalogToReadme(w io.Writer, repository *ProjectRepository, dbServer ProjDbServer, catalog DbCatalog) error
}

ReadmeEncoder defines an interface for encoder implementation that writes to MD files

type Recordset

type Recordset struct {
	Duration time.Duration     `json:"durationNanoseconds"`
	Columns  []RecordsetColumn `json:"columns"`
	Rows     [][]interface{}   `json:"rows"`
}

Recordset holds data & stats for recordset returned by executed command

func (Recordset) Validate

func (v Recordset) Validate() error

Validate returns error if not valid

type RecordsetBaseDef

type RecordsetBaseDef struct {
	PrimaryKey    *UniqueKey  `json:"primaryKey,omitempty"`
	ForeignKeys   ForeignKeys `json:"foreignKeys,omitempty"`
	AlternateKeys []UniqueKey `json:"alternateKey,omitempty"`
	ActiveIssues  *Issues     `json:"issues,omitempty"`
}

RecordsetBaseDef is used by: CollectionInfo, RecordsetDefinition

type RecordsetColumn

type RecordsetColumn struct {
	Name   string          `json:"name"`
	DbType string          `json:"dbType"`
	Meta   *EntityFieldRef `json:"meta"`
}

RecordsetColumn describes column in a recordset

func (RecordsetColumn) Validate

func (v RecordsetColumn) Validate() error

Validate returns error if not valid

type RecordsetColumnDef

type RecordsetColumnDef struct {
	Name     string             `json:"name"`
	Type     string             `json:"type"`
	Required bool               `json:"required,omitempty"`
	Meta     *EntityFieldRef    `json:"meta,omitempty"`
	HideIf   HideRecordsetColIf `json:"hideIf,omitempty"`
}

RecordsetColumnDef defines a column of a recordset

func (RecordsetColumnDef) Validate

func (v RecordsetColumnDef) Validate() error

Validate returns error if not valid

type RecordsetColumnDefs

type RecordsetColumnDefs []RecordsetColumnDef

RecordsetColumnDefs is a slice of RecordsetColumnDef

func (RecordsetColumnDefs) HasColumn

func (v RecordsetColumnDefs) HasColumn(name string, caseSensitive bool) bool

HasColumn checks if set of columns has a column with a given name

func (RecordsetColumnDefs) Validate

func (v RecordsetColumnDefs) Validate() error

Validate returns error if not valid

type RecordsetDefinition

type RecordsetDefinition struct {
	ProjectItem
	RecordsetBaseDef
	Columns RecordsetColumnDefs `json:"columns,omitempty" yaml:"columns,omitempty"`
	// -- formatting spacer --
	Type       string   `json:"type" yaml:"type,omitempty"` // Supported types: "recordset", "json"
	JSONSchema string   `json:"jsonSchema,omitempty" yaml:"jsonSchema,omitempty"`
	Files      []string `json:"files,omitempty" yaml:"files,omitempty"`
	Errors     []string `json:"errors,omitempty"`
}

RecordsetDefinition describes dataset

func (RecordsetDefinition) Validate

func (v RecordsetDefinition) Validate() error

Validate returns error if not valid

type RecordsetDefinitions added in v0.15.7

type RecordsetDefinitions []*RecordsetDefinition

type RecordsetDefinitionsStore added in v0.15.7

type RecordsetDefinitionsStore interface {
	LoadRecordsetDefinitions(ctx context.Context, o ...StoreOption) ([]*RecordsetDefinition, error)
	LoadRecordsetDefinition(ctx context.Context, id string, o ...StoreOption) (*RecordsetDefinition, error)
	LoadRecordsetData(ctx context.Context, id string) (Recordset, error)
}

type RefByForeignKey

type RefByForeignKey struct {
	Name        string   `json:"name"`
	Columns     []string `json:"columns"`
	MatchOption string   `json:"matchOption,omitempty"`
	UpdateRule  string   `json:"updateRule,omitempty"`
	DeleteRule  string   `json:"deleteRule,omitempty"`
}

RefByForeignKey holds metadata about reference by FK

type ReferencedBy added in v0.16.0

type ReferencedBy struct {
	DBCollectionKey
	ForeignKeys []*RefByForeignKey `json:"foreignKeys"`
}

ReferencedBy holds metadata about table/view that reference a table/view

type ReferencedBys added in v0.16.0

type ReferencedBys []*ReferencedBy

ReferencedBys defines slice

func (ReferencedBys) Validate added in v0.16.0

func (v ReferencedBys) Validate() error

Validate returns error if not valid

type RegexpValueCheck

type RegexpValueCheck struct {
	Regexp string `json:"regexp"`
}

RegexpValueCheck test value with regular expression

func (RegexpValueCheck) Validate

func (v RegexpValueCheck) Validate() error

Validate returns error if not valid

type RepoRootFile added in v0.15.11

type RepoRootFile struct {

	// List of paths to DataTug projects
	Projects []string `json:"projects,omitempty" yaml:"projects,omitempty"`
}

type SQLCheck

type SQLCheck struct {
	Query string `json:"query"`
}

SQLCheck holds and DDL that verifies data

func (SQLCheck) Validate

func (v SQLCheck) Validate() error

Validate returns error if not valid

type SQLWidgetDef

type SQLWidgetDef struct {
	WidgetBase
	SQL SQLWidgetSettings `json:"sql"`
}

SQLWidgetDef holds info about a widget that makes SQL queries

func (*SQLWidgetDef) Validate

func (v *SQLWidgetDef) Validate() error

Validate returns error if not valid

type SQLWidgetSettings

type SQLWidgetSettings struct {
	Query string `json:"query"`
}

SQLWidgetSettings holds settings for an DDL widget

func (SQLWidgetSettings) Validate

func (v SQLWidgetSettings) Validate() error

Validate returns error if not valid

type Schema added in v0.16.0

type Schema struct {
	ProjectItem
	Tables TableModels `json:"tables"`
	Views  TableModels `json:"views"`
}

Schema holds model for a DB schema

func (Schema) Validate added in v0.16.0

func (v Schema) Validate() error

Validate returns error if not valid

type SchemaDiff

type SchemaDiff struct {
	HitAndMiss
	TablesDiff TablesDiff `json:"tablesDiff"`
	ViewsDiff  TablesDiff `json:"viewsDiff"`
}

SchemaDiff holds schema diffs

type SchemaModels

type SchemaModels []*Schema

SchemaModels is a slice of *Schema

func (SchemaModels) GetByID

func (v SchemaModels) GetByID(id string) (schemaModel *Schema)

GetByID return *Schema by GetID

type SchemasDiff

type SchemasDiff []SchemaDiff

SchemasDiff holds list of schema diffs

type ServerRef added in v0.16.0

type ServerRef struct {
	Driver string `json:"driver"`
	Host   string `json:"host,omitempty"`
	Path   string `json:"path,omitempty"` // A path to a folder with database files - to be used by SQLite, for example.
	Port   int    `json:"port,omitempty"`
}

ServerRef hold info about DB server

func NewDbServer

func NewDbServer(driver, hostWithOptionalPort, sep string) (dbServer ServerRef, err error)

NewDbServer creates ServerRef

func (ServerRef) Address added in v0.16.0

func (v ServerRef) Address() string

Address returns a "host:port" string

func (ServerRef) FileName added in v0.16.0

func (v ServerRef) FileName() string

FileName returns a name for a file (probably should be moved to a func in filestore package)

func (ServerRef) GetID added in v0.16.0

func (v ServerRef) GetID() string

GetID returns string key for the server

func (ServerRef) Validate added in v0.16.0

func (v ServerRef) Validate() error

Validate returns error if not valid

type ServerReferences

type ServerReferences []ServerRef

ServerReferences defines slice

func (ServerReferences) Validate

func (v ServerReferences) Validate() error

Validate returns error if not valid

type StateByEnv

type StateByEnv map[string]*EnvState

StateByEnv states by env GetID

func (StateByEnv) Validate

func (v StateByEnv) Validate() error

Validate returns error if not valid

type StatusReporter added in v0.15.11

type StatusReporter func(step string, status string)

type Step added in v0.15.11

type Step struct {
	Name   string
	Status string
}

type StoreBrief added in v0.14.1

type StoreBrief struct {
	Type     string                  `json:"type,omitempty" firestore:"type,omitempty" yaml:"type,omitempty"`
	Title    string                  `json:"title,omitempty" firestore:"title,omitempty" yaml:"title,omitempty"`
	Projects map[string]ProjectBrief `json:"projects,omitempty" firestore:"projects,omitempty"`
}

StoreBrief stores info about datatug storage known to a user

func (StoreBrief) Validate added in v0.14.1

func (v StoreBrief) Validate() error

Validate returns error if not valid

type StoreOption added in v0.15.0

type StoreOption func(op *StoreOptions)

func Depth added in v0.16.0

func Depth(depth int) StoreOption

type StoreOptions added in v0.15.0

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

func GetStoreOptions added in v0.15.0

func GetStoreOptions(opts ...StoreOption) (o StoreOptions)

func (StoreOptions) Depth added in v0.16.0

func (o StoreOptions) Depth() int

func (StoreOptions) Next added in v0.16.0

func (o StoreOptions) Next() StoreOptions

func (StoreOptions) ToSlice added in v0.16.0

func (o StoreOptions) ToSlice() (options []StoreOption)

type StringPattern

type StringPattern struct {
	Type          string `json:"type,omitempty"` // Options: regexp, exact
	Value         string `json:"value,omitempty"`
	CaseSensitive bool   `json:"caseSensitive,omitempty"`
}

StringPattern hold patterns for names

func (StringPattern) Validate

func (v StringPattern) Validate() error

Validate returns error if not valid

type StringPatterns

type StringPatterns []*StringPattern

StringPatterns is a slice of *StringPattern

func (StringPatterns) Validate

func (v StringPatterns) Validate() error

Validate returns error if not valid

type TabWidget

type TabWidget struct {
	Title  string      `json:"title"`
	Widget BoardWidget `json:"widget,omitempty"`
}

TabWidget describes a tab widget

type TableColumns

type TableColumns []*ColumnInfo

TableColumns defines slice

func (TableColumns) ByPrimaryKeyPosition

func (v TableColumns) ByPrimaryKeyPosition() sort.Interface

ByPrimaryKeyPosition returns sort interface

func (TableColumns) Validate

func (v TableColumns) Validate() error

Validate returns error if not valid

type TableDiff

type TableDiff struct {
	HitAndMiss
	ColumnsDiff ColumnsDiff `json:"columnsDiff"`
}

TableDiff holds table diffs

type TableKeys

type TableKeys []DBCollectionKey

TableKeys is a []DBCollectionKey

func (TableKeys) Validate

func (v TableKeys) Validate() error

Validate returns error if not valid

type TableModel

type TableModel struct {
	DBCollectionKey
	DbType  string `json:"dbType,omitempty"` // e.g. "BASE TABLE", "VIEW", etc.
	Columns ColumnModels
	Checks  Checks     `json:"checks,omitempty"` // References to checks by type/id
	ByEnv   StateByEnv `json:"byEnv,omitempty"`
}

TableModel hold models for table or view

func (*TableModel) String

func (v *TableModel) String() string

func (*TableModel) Validate

func (v *TableModel) Validate() error

Validate returns error if not valid

type TableModels

type TableModels []*TableModel

TableModels is a slice of *TableModel

func (TableModels) GetByKey

func (v TableModels) GetByKey(k DBCollectionKey) *TableModel

GetByKey returns table by key (name, schema, catalog)

func (TableModels) GetByName

func (v TableModels) GetByName(name string) *TableModel

GetByName returns table by name

type TableProps

type TableProps struct {
	DbType     string       `json:"dbType,omitempty"` // e.g. "BASE TABLE", "VIEW", "Collection", etc.
	UniqueKeys []*UniqueKey `json:"uniqueKeys,omitempty"`
}

TableProps holds properties of a table

func (TableProps) Validate

func (v TableProps) Validate() error

Validate returns error if not valid

type Tables

type Tables []*CollectionInfo

Tables is a slice of *CollectionInfo

func (Tables) GetByKey

func (v Tables) GetByKey(k DBCollectionKey) *CollectionInfo

GetByKey return 9a *CollectionInfo by key or nil if not found

type TablesDiff

type TablesDiff []TableDiff

TablesDiff holds list of table diffs

type TabsWidgetDef

type TabsWidgetDef struct {
	WidgetBase
	Tabs []TabWidget `json:"tabs"`
}

TabsWidgetDef describes set of tab widgets

func (TabsWidgetDef) Validate

func (v TabsWidgetDef) Validate() error

Validate returns error if not valid

type UniqueKey

type UniqueKey struct {
	Name        string   `json:"name"`
	Columns     []string `json:"columns"`
	IsClustered bool     `json:"isClustered,omitempty"`
}

UniqueKey holds metadata about unique key

func (*UniqueKey) Validate

func (v *UniqueKey) Validate() error

Validate returns error if not valid

type UniqueKeys

type UniqueKeys []UniqueKey

UniqueKeys defines slice

func (UniqueKeys) Validate

func (v UniqueKeys) Validate() error

Validate returns error if not valid

type User added in v0.14.1

type User struct {
	Datatug *UserDatatugInfo `json:"datatug,omitempty" firestore:"datatug,omitempty"`
}

User defines a user record with props related to Datatug

func (User) Validate added in v0.14.1

func (v User) Validate() error

Validate returns error if not valid

type UserDatatugInfo

type UserDatatugInfo struct {
	Stores map[string]StoreBrief `json:"stores,omitempty" firestore:"stores,omitempty"`
}

UserDatatugInfo holds user info for DataTug project

func (UserDatatugInfo) Validate

func (v UserDatatugInfo) Validate() error

Validate returns error if not valid

type ValueRegexCheck

type ValueRegexCheck struct {
	Regex string `json:"regex"`
}

ValueRegexCheck holds regex to check

type VarInfo

type VarInfo struct {
	Type  string `json:"type" firestore:"type"`
	Value string `json:"value,omitempty" firestore:"value,omitempty"`
}

VarInfo hold info about var type & value

func (VarInfo) Validate

func (v VarInfo) Validate() error

Validate validates record

type VarSetting

type VarSetting struct {
	Type         string `json:"type" firestore:"type"`
	ValuePattern string `json:"valuePattern,omitempty" firestore:"valuePattern,omitempty"`
	Min          *int   `json:"min,omitempty" firestore:"min,omitempty"`
	Max          *int   `json:"max,omitempty" firestore:"max,omitempty"`
}

VarSetting record

func (VarSetting) Validate

func (v VarSetting) Validate() error

Validate validates record

type Variables

type Variables struct {
	Vars map[string]VarInfo `json:"vars,omitempty" firestore:"vars,omitempty"`
}

Variables properties holder

func (Variables) Validate

func (v Variables) Validate() error

Validate validates record

type VarsByID

type VarsByID = map[string]VarInfo

VarsByID type alias

type WidgetBase

type WidgetBase struct {
	Title      string     `json:"title,omitempty"`
	Parameters Parameters `json:"parameters,omitempty"`
}

WidgetBase is base struct for widgets

func (WidgetBase) Validate

func (v WidgetBase) Validate(isTitleRequired bool) error

Validate returns error if not valid

Jump to

Keyboard shortcuts

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