api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DataTugAgentVersion = "0.0.1"

DataTugAgentVersion specifies agent version

Variables

This section is empty.

Functions

func AddDbServer

func AddDbServer(ctx context.Context, ref dto.ProjectRef, projDbServer models.ProjDbServer) error

AddDbServer adds db server to project

func AddRecords

func AddRecords(projectID, datasetID, recordsetID string, _ []map[string]interface{}) error

AddRecords adds record

func AddRowsToRecordset

func AddRowsToRecordset(params RecordsetDataRequestParams, _ []RowValues) (numberOfRecords int, err error)

AddRowsToRecordset adds rows to a recordset

func CreateBoard

func CreateBoard(ctx context.Context, ref dto.ProjectRef, board models.Board) (*models.Board, error)

CreateBoard creates board

func CreateFolder

func CreateFolder(ctx context.Context, request dto.CreateFolder) (folder *models.Folder, err error)

CreateFolder creates a new folder for queries

func CreateProject

func CreateProject(ctx context.Context, request dto.CreateProjectRequest) (*models.ProjectSummary, error)

CreateProject create a new DataTug project using requested store

func CreateQuery

func CreateQuery(ctx context.Context, request dto.CreateQuery) (*models.QueryDefWithFolderPath, error)

CreateQuery creates a new query

func DeleteBoard

func DeleteBoard(ctx context.Context, ref dto.ProjectItemRef) error

DeleteBoard deletes board

func DeleteDbServer

func DeleteDbServer(ctx context.Context, ref dto.ProjectRef, dbServer models.ServerReference) (err error)

DeleteDbServer adds db server to project

func DeleteEntity

func DeleteEntity(ctx context.Context, ref dto.ProjectItemRef) error

DeleteEntity deletes board

func DeleteFolder

func DeleteFolder(ctx context.Context, ref dto.ProjectItemRef) error

DeleteFolder deletes queries folder

func DeleteQuery

func DeleteQuery(ctx context.Context, ref dto.ProjectItemRef) error

DeleteQuery deletes query

func ExecuteCommands

func ExecuteCommands(storeID string, request execute.Request) (response execute.Response, err error)

ExecuteCommands executes command

func ExecuteSelect

func ExecuteSelect(storeID string, selectRequest SelectRequest) (response execute.Response, err error)

ExecuteSelect executes select command

func GetAllEntities

func GetAllEntities(ctx context.Context, ref dto.ProjectRef) (entity models.Entities, err error)

GetAllEntities returns all entities

func GetBoard

func GetBoard(ctx context.Context, ref dto.ProjectItemRef) (*models.Board, error)

GetBoard returns board by ID

func GetDatasetDefinition

func GetDatasetDefinition(ctx context.Context, ref dto2.ProjectItemRef) (dataset *models.RecordsetDefinition, err error)

GetDatasetDefinition returns definition of a dataset by ID

func GetDbServerSummary

func GetDbServerSummary(ctx context.Context, ref dto.ProjectRef, dbServer models.ServerReference) (*models.ProjDbServerSummary, error)

GetDbServerSummary returns summary on DB server

func GetEntity

func GetEntity(ctx context.Context, ref dto.ProjectItemRef) (entity *models.Entity, err error)

GetEntity returns board by ID

func GetEnvironmentSummary

func GetEnvironmentSummary(ctx context.Context, ref dto.ProjectItemRef) (*models.EnvironmentSummary, error)

GetEnvironmentSummary returns environment summary

func GetProjectFull

func GetProjectFull(ctx context.Context, ref dto.ProjectRef) (*models.DatatugProject, error)

GetProjectFull returns full project metadata

func GetProjectSummary

func GetProjectSummary(ctx context.Context, ref dto.ProjectRef) (*models.ProjectSummary, error)

GetProjectSummary returns project summary

func GetProjects

func GetProjects(ctx context.Context, storeID string) ([]models.ProjectBrief, error)

GetProjects return all projects

func GetQuery

func GetQuery(ctx context.Context, ref dto.ProjectItemRef) (query *models.QueryDefWithFolderPath, err error)

GetQuery returns query definition

func GetRecordset

func GetRecordset(ctx context.Context, ref dto2.ProjectItemRef) (recordset *models.Recordset, err error)

GetRecordset saves board

func GetRecordsetsSummary

func GetRecordsetsSummary(ctx context.Context, ref dto2.ProjectRef) (*dto2.ProjRecordsetSummary, error)

GetRecordsetsSummary returns board by ID

func GetServerDatabases

func GetServerDatabases(request dto.GetServerDatabasesRequest) (databases []*models.DbCatalog, err error)

GetServerDatabases returns list of databases hosted at a server

func RemoveRowsFromRecordset

func RemoveRowsFromRecordset(params RecordsetDataRequestParams, rows []RowWithIndex) (numberOfRecords int, err error)

RemoveRowsFromRecordset removes rows from a recordset

func SaveBoard

func SaveBoard(ctx context.Context, ref dto.ProjectRef, board models.Board) (*models.Board, error)

SaveBoard saves board

func SaveEntity

func SaveEntity(ctx context.Context, ref dto.ProjectRef, entity *models.Entity) error

SaveEntity saves board

func UpdateDbSchema

func UpdateDbSchema(ctx context.Context, projectLoader ProjectLoader, projectID, environment, driver, dbModelID string, dbConnParams dbconnection.Params) (project *models.DatatugProject, err error)

UpdateDbSchema updates DB schema

func UpdateDbServer

func UpdateDbServer(ctx context.Context, ref dto.ProjectRef, projDbServer models.ProjDbServer) error

UpdateDbServer adds db server to project

func UpdateQuery

func UpdateQuery(ctx context.Context, request dto.UpdateQuery) (*models.QueryDefWithFolderPath, error)

UpdateQuery updates existing query

func UpdateRowsInRecordset

func UpdateRowsInRecordset(params RecordsetDataRequestParams, rows []RowWithIndexAndNewValues) (numberOfRecords int, err error)

UpdateRowsInRecordset updates rows in a recordset

Types

type AgentInfo

type AgentInfo struct {
	Version       string  `json:"version"`
	UptimeMinutes float64 `json:"uptimeMinutes"`
}

AgentInfo holds agent info

func GetAgentInfo

func GetAgentInfo() AgentInfo

GetAgentInfo returns agent info

type ProjectLoader

type ProjectLoader interface {
	// Loads project summary
	LoadProjectSummary(ctx context.Context) (projectSummary models.ProjectSummary, err error)
	// Loads the whole project
	LoadProject(ctx context.Context) (project *models.DatatugProject, err error)
}

ProjectLoader defines an interface to load project info

type RecordsetDataRequestParams

type RecordsetDataRequestParams struct {
	RecordsetRequestParams
	Data string `json:"data"`
}

RecordsetDataRequestParams is a set of common request parameters

func (RecordsetDataRequestParams) Validate

func (v RecordsetDataRequestParams) Validate() error

Validate returns error if not valid

type RecordsetRequestParams

type RecordsetRequestParams struct {
	Project   string `json:"project"`
	Recordset string `json:"recordset"`
}

RecordsetRequestParams is a set of common request parameters

func (RecordsetRequestParams) Validate

func (v RecordsetRequestParams) Validate() error

Validate returns error if not valid

type RowValues

type RowValues = map[string]interface{}

RowValues set of named values

type RowWithIndex

type RowWithIndex struct {
	Index  int                    `json:"index"`
	Values map[string]interface{} `json:"values"`
}

RowWithIndex points to specific row with expected values

func (RowWithIndex) Validate

func (v RowWithIndex) Validate() error

Validate returns error if not valid

type RowWithIndexAndNewValues

type RowWithIndexAndNewValues struct {
	RowWithIndex
	NewValues map[string]interface{} `json:"newValues"`
}

RowWithIndexAndNewValues points to specific row with expected values and provides new set of named values

type SelectRequest

type SelectRequest struct {
	Project     string
	Environment string
	Database    string
	From        string
	SQL         string
	Where       string
	Limit       int
	Columns     []string
	Parameters  []models.Parameter
}

SelectRequest holds request data

func (SelectRequest) Validate

func (v SelectRequest) Validate() 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