srvhelper

package
v0.0.0-...-1fa52ee Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0, BSD-2-Clause, ISC, + 1 more Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionSrvHelper

type ConnectionSrvHelper[C plugin.ToolLayerConnection, S plugin.ToolLayerScope, SC plugin.ToolLayerScopeConfig] struct {
	*ModelSrvHelper[C]
	// contains filtered or unexported fields
}

ConnectionSrvHelper

func NewConnectionSrvHelper

func NewConnectionSrvHelper[
	C plugin.ToolLayerConnection,
	S plugin.ToolLayerScope,
	SC plugin.ToolLayerScopeConfig,
](
	basicRes context.BasicRes,
	pluginName string,
) *ConnectionSrvHelper[C, S, SC]

NewConnectionSrvHelper creates a ConnectionDalHelper for connection management

func (*ConnectionSrvHelper[C, S, SC]) DeleteConnection

func (connSrv *ConnectionSrvHelper[C, S, SC]) DeleteConnection(connection *C) (refs *DsRefs, err errors.Error)

type CustomValidator

type CustomValidator interface {
	CustomValidate(entity interface{}, validate *validator.Validate) errors.Error
}

type DsRefs

type DsRefs struct {
	Blueprints []string `json:"blueprints"`
	Projects   []string `json:"projects"`
}

type ModelSrvHelper

type ModelSrvHelper[M dal.Tabler] struct {
	// contains filtered or unexported fields
}

func NewModelSrvHelper

func NewModelSrvHelper[M dal.Tabler](basicRes context.BasicRes, searchColumns []string) *ModelSrvHelper[M]

func (*ModelSrvHelper[M]) Create

func (srv *ModelSrvHelper[M]) Create(model *M) errors.Error

Create validates given model and insert it into database if validation passed

func (*ModelSrvHelper[M]) CreateOrUpdate

func (srv *ModelSrvHelper[M]) CreateOrUpdate(model *M) errors.Error

CreateOrUpdate validates given model and insert or update it into database if validation passed

func (*ModelSrvHelper[M]) DeleteModel

func (srv *ModelSrvHelper[M]) DeleteModel(model *M) errors.Error

DeleteModel deletes given model from database

func (*ModelSrvHelper[M]) FindByPk

func (srv *ModelSrvHelper[M]) FindByPk(pk ...interface{}) (*M, errors.Error)

FindByPk returns model with given primary key from database

func (*ModelSrvHelper[M]) GetAll

func (srv *ModelSrvHelper[M]) GetAll() ([]*M, errors.Error)

GetAll returns all models from database

func (*ModelSrvHelper[M]) GetPage

func (srv *ModelSrvHelper[M]) GetPage(pagination *Pagination, query ...dal.Clause) ([]*M, int64, errors.Error)

func (*ModelSrvHelper[M]) NewTx

func (srv *ModelSrvHelper[M]) NewTx(tx dal.Transaction) *ModelSrvHelper[M]

func (*ModelSrvHelper[M]) NoRunningPipeline

func (srv *ModelSrvHelper[M]) NoRunningPipeline(fn func(tx dal.Transaction) errors.Error, tablesToLock ...*dal.LockTable) (err errors.Error)

func (*ModelSrvHelper[M]) Update

func (srv *ModelSrvHelper[M]) Update(model *M) errors.Error

Update validates given model and update it into database if validation passed

func (*ModelSrvHelper[M]) ValidateModel

func (srv *ModelSrvHelper[M]) ValidateModel(model *M) errors.Error

type NoScopeConfig

type NoScopeConfig struct{}

NoScopeConfig is a placeholder for plugins that don't have any scope configuration yet

func (NoScopeConfig) ScopeConfigConnectionId

func (NoScopeConfig) ScopeConfigConnectionId() uint64

func (NoScopeConfig) ScopeConfigId

func (NoScopeConfig) ScopeConfigId() uint64

func (NoScopeConfig) TableName

func (NoScopeConfig) TableName() string

type Pagination

type Pagination struct {
	Page       int    `json:"page" mapstructure:"page" validate:"min=1"`
	PageSize   int    `json:"pageSize" mapstructure:"pageSize" validate:"min=1,max=1000"`
	SearchTerm string `json:"searchTerm" mapstructure:"searchTerm"`
}

func (*Pagination) GetLimit

func (pagination *Pagination) GetLimit() int

func (*Pagination) GetOffset

func (pagination *Pagination) GetOffset() int

func (*Pagination) GetPage

func (pagination *Pagination) GetPage() int

type ScopeConfigSrvHelper

type ScopeConfigSrvHelper[C plugin.ToolLayerConnection, S plugin.ToolLayerScope, SC plugin.ToolLayerScopeConfig] struct {
	*ModelSrvHelper[SC]
}

ScopeConfigSrvHelper

func NewScopeConfigSrvHelper

func NewScopeConfigSrvHelper[
	C plugin.ToolLayerConnection,
	S plugin.ToolLayerScope,
	SC plugin.ToolLayerScopeConfig,
](basicRes context.BasicRes, searchColumns []string) *ScopeConfigSrvHelper[C, S, SC]

func (*ScopeConfigSrvHelper[C, S, SC]) DeleteScopeConfig

func (scopeConfigSrv *ScopeConfigSrvHelper[C, S, SC]) DeleteScopeConfig(scopeConfig *SC) (refs []*S, err errors.Error)

func (*ScopeConfigSrvHelper[C, S, SC]) GetAllByConnectionId

func (scopeConfigSrv *ScopeConfigSrvHelper[C, S, SC]) GetAllByConnectionId(connectionId uint64) ([]*SC, errors.Error)

type ScopeDetail

type ScopeDetail[S plugin.ToolLayerScope, SC plugin.ToolLayerScopeConfig] struct {
	Scope       S                   `json:"scope"`
	ScopeConfig *SC                 `json:"scopeConfig,omitempty"`
	Blueprints  []*models.Blueprint `json:"blueprints,omitempty"`
}

type ScopePagination

type ScopePagination struct {
	Pagination   `mapstructure:",squash"`
	ConnectionId uint64 `json:"connectionId" mapstructure:"connectionId" validate:"required"`
	Blueprints   bool   `json:"blueprints" mapstructure:"blueprints"`
}

type ScopeSrvHelper

type ScopeSrvHelper[C plugin.ToolLayerConnection, S plugin.ToolLayerScope, SC plugin.ToolLayerScopeConfig] struct {
	*ModelSrvHelper[S]
	// contains filtered or unexported fields
}

func NewScopeSrvHelper

func NewScopeSrvHelper[
	C plugin.ToolLayerConnection,
	S plugin.ToolLayerScope,
	SC plugin.ToolLayerScopeConfig,
](
	basicRes context.BasicRes,
	pluginName string,
	searchColumns []string,
) *ScopeSrvHelper[C, S, SC]

NewScopeSrvHelper creates a ScopeDalHelper for scope management

func (*ScopeSrvHelper[C, S, SC]) DeleteScope

func (scopeSrv *ScopeSrvHelper[C, S, SC]) DeleteScope(scope *S, dataOnly bool) (refs *DsRefs, err errors.Error)

func (*ScopeSrvHelper[C, S, SC]) GetPluginName

func (scopeSrv *ScopeSrvHelper[C, S, SC]) GetPluginName() string

func (*ScopeSrvHelper[C, S, SC]) GetScopeDetail

func (scopeSrv *ScopeSrvHelper[C, S, SC]) GetScopeDetail(includeBlueprints bool, pkv ...interface{}) (*ScopeDetail[S, SC], errors.Error)

func (*ScopeSrvHelper[C, S, SC]) GetScopeLatestSyncState

func (scopeSrv *ScopeSrvHelper[C, S, SC]) GetScopeLatestSyncState(pkv ...interface{}) ([]*models.LatestSyncState, errors.Error)

func (*ScopeSrvHelper[C, S, SC]) GetScopesPage

func (scopeSrv *ScopeSrvHelper[C, S, SC]) GetScopesPage(pagination *ScopePagination) ([]*ScopeDetail[S, SC], int64, errors.Error)

func (*ScopeSrvHelper[C, S, SC]) MapScopeDetails

func (scopeSrv *ScopeSrvHelper[C, S, SC]) MapScopeDetails(connectionId uint64, bpScopes []*models.BlueprintScope) ([]*ScopeDetail[S, SC], errors.Error)

MapScopeDetails returns scope details (scope and scopeConfig) for the given blueprint scopes

func (*ScopeSrvHelper[C, S, SC]) Validate

func (scopeSrv *ScopeSrvHelper[C, S, SC]) Validate(scope *S) errors.Error

Jump to

Keyboard shortcuts

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