helper

package
v0.0.0-...-7d3b672 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProjectRoot = ""
	Shell       = ""
)

Functions

func AddToPath

func AddToPath(newPaths ...string)

AddToPath FIXME

func Cast

func Cast[T any](m any) T

func Contains

func Contains[T any](list []T, elem any) bool

func FromMap

func FromMap[T any](x map[string]any) *T

func GetSubtaskNames

func GetSubtaskNames(metas ...plugin.SubTaskMeta) []string

GetSubtaskNames FIXME

func GetTestConfig

func GetTestConfig[T any]() T

func InitDB

func InitDB(dbUrl string)

InitDB Bootstraps the database by getting rid of all the tables

func IsWSL

func IsWSL() bool

IsWSL FIXME

func NormalizeBaseDirectory

func NormalizeBaseDirectory() (string, errors.Error)

func SetTestConfig

func SetTestConfig[T any](t T)

func ToCleanJson

func ToCleanJson(inline bool, x any) json.RawMessage

ToCleanJson FIXME

func ToJson

func ToJson(x any) json.RawMessage

ToJson FIXME

func ToMap

func ToMap(x any) map[string]any

func UseMySQL

func UseMySQL(host string, port int) string

UseMySQL FIXME

func UsePostgres

func UsePostgres(host string, port int) string

UsePostgres FIXME

func Val

func Val[T any](t T) *T

Types

type BlueprintV2Config

type BlueprintV2Config struct {
	Connection  *plugin.BlueprintConnectionV200
	TimeAfter   *time.Time
	SkipOnFail  bool
	ProjectName string
}

type Connection

type Connection struct {
	api.BaseConnection `mapstructure:",squash"`
	api.RestConnection `mapstructure:",squash"`
	api.AccessToken    `mapstructure:",squash"`
}

type DevlakeClient

type DevlakeClient struct {
	Endpoint string
	// contains filtered or unexported fields
}

DevlakeClient FIXME

func ConnectDevLakeServer

func ConnectDevLakeServer(t *testing.T) *DevlakeClient

Connect to an existing DevLake server with default config. Tables are truncated. Useful for troubleshooting outside the IDE.

func ConnectLocalServer

func ConnectLocalServer(t *testing.T, clientConfig *LocalClientConfig) *DevlakeClient

ConnectLocalServer spins up a local server from the config and returns a client connected to it

func ConnectRemoteServer

func ConnectRemoteServer(t *testing.T, clientConfig *RemoteClientConfig) *DevlakeClient

ConnectRemoteServer returns a client to an existing server based on the config

func StartDevLakeServer

func StartDevLakeServer(t *testing.T, loadedGoPlugins []plugin.PluginMeta) *DevlakeClient

Creates a new in-memory DevLake server with default settings and returns a client to it

func (*DevlakeClient) AwaitPluginAvailability

func (d *DevlakeClient) AwaitPluginAvailability(pluginName string, timeout time.Duration)

AwaitPluginAvailability wait for this plugin to become available on the server given a timeout. Returns false if this condition does not get met.

func (*DevlakeClient) CreateBasicBlueprintV2

func (d *DevlakeClient) CreateBasicBlueprintV2(name string, config *BlueprintV2Config) models.Blueprint

CreateBasicBlueprintV2 FIXME

func (*DevlakeClient) CreateConnection

func (d *DevlakeClient) CreateConnection(pluginName string, connection any) *Connection

CreateConnection FIXME

func (*DevlakeClient) CreateProject

func (d *DevlakeClient) CreateProject(project *ProjectConfig) models.ApiOutputProject

func (*DevlakeClient) CreateScopeConfig

func (d *DevlakeClient) CreateScopeConfig(pluginName string, connectionId uint64, scopeConfig any) any

func (*DevlakeClient) CreateScopes

func (d *DevlakeClient) CreateScopes(pluginName string, connectionId uint64, scopes ...any) any

func (*DevlakeClient) DeleteBlueprint

func (d *DevlakeClient) DeleteBlueprint(blueprintId uint64)

func (*DevlakeClient) DeleteConnection

func (d *DevlakeClient) DeleteConnection(pluginName string, connectionId uint64) services.BlueprintProjectPairs

DeleteConnection FIXME

func (*DevlakeClient) DeleteProject

func (d *DevlakeClient) DeleteProject(projectName string)

func (*DevlakeClient) DeleteScope

func (d *DevlakeClient) DeleteScope(pluginName string, connectionId uint64, scopeId string, deleteDataOnly bool) services.BlueprintProjectPairs

func (*DevlakeClient) DeleteScopeConfig

func (d *DevlakeClient) DeleteScopeConfig(pluginName string, connectionId uint64, scopeConfigId uint64)

func (*DevlakeClient) GetBlueprint

func (d *DevlakeClient) GetBlueprint(blueprintId uint64) models.Blueprint

func (*DevlakeClient) GetDal

func (d *DevlakeClient) GetDal() dal.Dal

GetDal get a reference to the dal.Dal used by the server

func (*DevlakeClient) GetProject

func (d *DevlakeClient) GetProject(projectName string) models.ApiOutputProject

func (*DevlakeClient) GetScope

func (d *DevlakeClient) GetScope(pluginName string, connectionId uint64, scopeId string, listBlueprints bool) ScopeResponse

func (*DevlakeClient) GetScopeConfig

func (d *DevlakeClient) GetScopeConfig(pluginName string, connectionId uint64, scopeConfigId uint64) any

func (*DevlakeClient) LastReturnedStatusCode

func (d *DevlakeClient) LastReturnedStatusCode() int

SetExpectedStatusCode return the last http status code

func (*DevlakeClient) ListBlueprints

func (d *DevlakeClient) ListBlueprints() blueprints.PaginatedBlueprint

func (*DevlakeClient) ListConnections

func (d *DevlakeClient) ListConnections(pluginName string) []*Connection

ListConnections FIXME

func (*DevlakeClient) ListProjects

func (d *DevlakeClient) ListProjects() apiProject.PaginatedProjects

func (*DevlakeClient) ListScopeConfigs

func (d *DevlakeClient) ListScopeConfigs(pluginName string, connectionId uint64) []any

func (*DevlakeClient) ListScopes

func (d *DevlakeClient) ListScopes(pluginName string, connectionId uint64, listBlueprints bool) []ScopeResponse

func (*DevlakeClient) PatchScopeConfig

func (d *DevlakeClient) PatchScopeConfig(pluginName string, connectionId uint64, scopeConfigId uint64, scopeConfig any) any

func (*DevlakeClient) RemoteScopes

func (d *DevlakeClient) RemoteScopes(query RemoteScopesQuery) RemoteScopesOutput

func (*DevlakeClient) RunPipeline

func (d *DevlakeClient) RunPipeline(pipeline models.NewPipeline) models.Pipeline

RunPipeline FIXME

func (*DevlakeClient) RunPlugin

func (d *DevlakeClient) RunPlugin(ctx context.Context, pluginName string, pluginTask plugin.PluginTask, options map[string]interface{}, subtaskNames ...string) errors.Error

RunPlugin manually execute a plugin directly (local server only)

func (*DevlakeClient) SearchRemoteScopes

func (d *DevlakeClient) SearchRemoteScopes(query SearchRemoteScopesQuery) SearchRemoteScopesOutput

SearchRemoteScopes makes calls to the "scope API" indirectly. "Search" is the remote endpoint to hit.

func (*DevlakeClient) SetExpectedStatusCode

func (d *DevlakeClient) SetExpectedStatusCode(code int) *DevlakeClient

SetExpectedStatusCode override the expected status code of the next API call. If it's anything but this, the test will fail.

func (*DevlakeClient) SetPipelineTimeout

func (d *DevlakeClient) SetPipelineTimeout(timeout time.Duration)

SetTimeout override the timeout of pipeline run success expectation

func (*DevlakeClient) SetTimeout

func (d *DevlakeClient) SetTimeout(timeout time.Duration)

SetTimeout override the timeout of api requests

func (*DevlakeClient) TestConnection

func (d *DevlakeClient) TestConnection(pluginName string, connection any)

CreateConnection FIXME

func (*DevlakeClient) TriggerBlueprint

func (d *DevlakeClient) TriggerBlueprint(blueprintId uint64) models.Pipeline

TriggerBlueprint FIXME

func (*DevlakeClient) UpdateScope

func (d *DevlakeClient) UpdateScope(pluginName string, connectionId uint64, scopeId string, scope any) any

type LocalClientConfig

type LocalClientConfig struct {
	ServerPort      uint
	DbURL           string
	CreateServer    bool
	DropDb          bool
	TruncateDb      bool
	Plugins         []plugin.PluginMeta
	Timeout         time.Duration
	PipelineTimeout time.Duration
}

DevlakeClient FIXME

type ProjectConfig

type ProjectConfig struct {
	ProjectName        string
	ProjectDescription string
	EnableDora         bool
	MetricPlugins      []ProjectPlugin
}

type ProjectPlugin

type ProjectPlugin struct {
	Name    string
	Options any
}

type RemoteClientConfig

type RemoteClientConfig struct {
	Endpoint   string
	DbURL      string
	TruncateDb bool
}

DevlakeClient FIXME

type RemoteScopesChild

type RemoteScopesChild struct {
	Type     string      `json:"type"`
	ParentId *string     `json:"parentId"`
	Id       string      `json:"id"`
	Name     string      `json:"name"`
	Data     interface{} `json:"data"`
}

type RemoteScopesOutput

type RemoteScopesOutput struct {
	Children      []RemoteScopesChild `json:"children"`
	NextPageToken string              `json:"nextPageToken"`
}

type RemoteScopesQuery

type RemoteScopesQuery struct {
	PluginName   string
	ConnectionId uint64
	GroupId      string
	PageToken    string
	Params       map[string]string
}

type ScopeResponse

type ScopeResponse struct {
	Scope       any
	ScopeConfig any
	Blueprints  []*models.Blueprint
}

type SearchRemoteScopesOutput

type SearchRemoteScopesOutput struct {
	Children []RemoteScopesChild `json:"children"`
	Page     int                 `json:"page"`
	PageSize int                 `json:"pageSize"`
}

type SearchRemoteScopesQuery

type SearchRemoteScopesQuery struct {
	PluginName   string
	ConnectionId uint64
	Search       string
	Page         int
	PageSize     int
	Params       map[string]string
}

Jump to

Keyboard shortcuts

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