Documentation
¶
Index ¶
- Variables
- type Asset
- type AssetSource
- type AssetSummary
- type AssetTerm
- type AssetTypeSummary
- type AvailableFilters
- type CreateInput
- type Environment
- type ExternalLink
- type Filter
- type HistogramBucket
- type Logger
- type MembershipObserver
- type MetadataContext
- type MetadataFieldSuggestion
- type MetadataValueSuggestion
- type MetricsClient
- type NotificationObserver
- type PostgresRepository
- func (r *PostgresRepository) AddTerms(ctx context.Context, assetID string, termIDs []string, source string, ...) error
- func (r *PostgresRepository) Create(ctx context.Context, asset *Asset) error
- func (r *PostgresRepository) Delete(ctx context.Context, id string) error
- func (r *PostgresRepository) DeleteByMRN(ctx context.Context, mrn string) error
- func (r *PostgresRepository) Get(ctx context.Context, id string) (*Asset, error)
- func (r *PostgresRepository) GetAssetsByTerm(ctx context.Context, termID string, limit, offset int) ([]*Asset, int, error)
- func (r *PostgresRepository) GetByMRN(ctx context.Context, qualifiedName string) (*Asset, error)
- func (r *PostgresRepository) GetByMRNs(ctx context.Context, mrns []string) ([]*Asset, error)
- func (r *PostgresRepository) GetByTypeAndName(ctx context.Context, assetType, name string) (*Asset, error)
- func (r *PostgresRepository) GetMetadataFields(ctx context.Context) ([]MetadataFieldSuggestion, error)
- func (r *PostgresRepository) GetMetadataFieldsWithContext(ctx context.Context, queryContext *MetadataContext) ([]MetadataFieldSuggestion, error)
- func (r *PostgresRepository) GetMetadataValues(ctx context.Context, field string, prefix string, limit int) ([]MetadataValueSuggestion, error)
- func (r *PostgresRepository) GetMetadataValuesWithContext(ctx context.Context, field string, prefix string, limit int, ...) ([]MetadataValueSuggestion, error)
- func (r *PostgresRepository) GetMyAssets(ctx context.Context, userID string, teamIDs []string, limit, offset int) ([]*Asset, int, error)
- func (r *PostgresRepository) GetRunHistory(ctx context.Context, assetID string, limit, offset int) ([]*RunHistory, int, error)
- func (r *PostgresRepository) GetRunHistoryHistogram(ctx context.Context, assetID string, days int) ([]HistogramBucket, error)
- func (r *PostgresRepository) GetTagSuggestions(ctx context.Context, prefix string, limit int) ([]string, error)
- func (r *PostgresRepository) GetTerms(ctx context.Context, assetID string) ([]AssetTerm, error)
- func (r *PostgresRepository) ListByPattern(ctx context.Context, pattern string, assetType string) ([]*Asset, error)
- func (r *PostgresRepository) RemoveTerm(ctx context.Context, assetID string, termID string) error
- func (r *PostgresRepository) Search(ctx context.Context, filter SearchFilter, calculateCounts bool) ([]*Asset, int, AvailableFilters, error)
- func (r *PostgresRepository) Summary(ctx context.Context) (*AssetSummary, error)
- func (r *PostgresRepository) Update(ctx context.Context, asset *Asset) error
- type Repository
- type RunHistory
- type SearchFilter
- type Service
- type ServiceOption
- type UpdateInput
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Asset ¶
type Asset struct {
ID string `json:"id,omitempty"`
ParentMRN *string `json:"parent_mrn,omitempty"`
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
UserDescription *string `json:"user_description,omitempty"`
Type string `json:"type"`
Providers []string `json:"providers"`
MRN *string `json:"mrn,omitempty"`
Schema map[string]string `json:"schema,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
Sources []AssetSource `json:"sources,omitempty"`
Tags []string `json:"tags,omitempty"`
Environments map[string]Environment `json:"environments,omitempty"`
Query *string `json:"query,omitempty"`
QueryLanguage *string `json:"query_language,omitempty"`
IsStub bool `json:"is_stub"`
ExternalLinks []ExternalLink `json:"external_links,omitempty"`
HasRunHistory bool `json:"has_run_history"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
LastSyncAt time.Time `json:"last_sync_at,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
}
type AssetSource ¶
type AssetSource struct {
Name string `json:"name"`
LastSyncAt time.Time `json:"last_sync_at"`
Properties map[string]interface{} `json:"properties"`
Priority int `json:"priority"`
}
func UpdateSources ¶
func UpdateSources(existing, new []AssetSource) []AssetSource
type AssetSummary ¶
type AssetTerm ¶ added in v0.4.0
type AssetTerm struct {
TermID string `json:"term_id"`
TermName string `json:"term_name"`
Definition string `json:"definition"`
Source string `json:"source"` // "user" or "plugin:name"
CreatedAt time.Time `json:"created_at"`
CreatedBy *string `json:"created_by,omitempty"`
CreatedByUsername *string `json:"created_by_username,omitempty"`
}
type AssetTypeSummary ¶
type AvailableFilters ¶
type CreateInput ¶
type CreateInput struct {
Name *string `json:"name" validate:"required"`
MRN *string `json:"mrn" validate:"required"`
Type string `json:"type" validate:"required"`
Providers []string `json:"providers" validate:"required"`
Description *string `json:"description"`
Metadata map[string]interface{} `json:"metadata"`
Schema map[string]string `json:"schema"`
Tags []string `json:"tags"`
CreatedBy string `json:"created_by" validate:"required"`
Sources []AssetSource `json:"sources"`
Environments map[string]Environment `json:"environments"`
ExternalLinks []ExternalLink `json:"external_links"`
Query *string `json:"query,omitempty"`
QueryLanguage *string `json:"query_language,omitempty"`
IsStub bool `json:"is_stub"`
}
type Environment ¶
type ExternalLink ¶
type Filter ¶
type Filter struct {
Types []string `json:"types,omitempty"`
Providers []string `json:"providers,omitempty"`
Tags []string `json:"tags,omitempty"`
ParentMRN *string `json:"parent_mrn,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
UpdatedAfter *time.Time `json:"updated_after,omitempty"`
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
Environment *string `json:"environment,omitempty"`
IncludeStubs bool `json:"include_stubs,omitempty"`
OwnerType *string `json:"owner_type,omitempty"`
OwnerID *string `json:"owner_id,omitempty"`
}
type HistogramBucket ¶ added in v0.3.0
type MembershipObserver ¶ added in v0.5.0
type MembershipObserver interface {
OnAssetCreated(ctx context.Context, asset *Asset)
OnAssetDeleted(ctx context.Context, assetID string) error
}
MembershipObserver is notified when assets are created or deleted. This allows the data product membership service to update memberships.
type MetadataContext ¶
type MetadataFieldSuggestion ¶
type MetadataValueSuggestion ¶
type MetricsClient ¶
type NotificationObserver ¶ added in v0.6.0
type NotificationObserver interface {
OnAssetUpdated(ctx context.Context, asset *Asset, changeType string)
}
NotificationObserver is notified when assets are modified.
type PostgresRepository ¶
type PostgresRepository struct {
// contains filtered or unexported fields
}
func NewPostgresRepository ¶
func NewPostgresRepository(db *pgxpool.Pool, recorder metrics.Recorder) *PostgresRepository
func (*PostgresRepository) AddTerms ¶ added in v0.4.0
func (r *PostgresRepository) AddTerms(ctx context.Context, assetID string, termIDs []string, source string, createdBy string) error
AddTerms associates glossary terms with an asset
func (*PostgresRepository) Create ¶
func (r *PostgresRepository) Create(ctx context.Context, asset *Asset) error
func (*PostgresRepository) Delete ¶
func (r *PostgresRepository) Delete(ctx context.Context, id string) error
func (*PostgresRepository) DeleteByMRN ¶ added in v0.3.0
func (r *PostgresRepository) DeleteByMRN(ctx context.Context, mrn string) error
func (*PostgresRepository) GetAssetsByTerm ¶ added in v0.4.0
func (r *PostgresRepository) GetAssetsByTerm(ctx context.Context, termID string, limit, offset int) ([]*Asset, int, error)
GetAssetsByTerm retrieves all assets associated with a glossary term
func (*PostgresRepository) GetByTypeAndName ¶
func (*PostgresRepository) GetMetadataFields ¶
func (r *PostgresRepository) GetMetadataFields(ctx context.Context) ([]MetadataFieldSuggestion, error)
func (*PostgresRepository) GetMetadataFieldsWithContext ¶
func (r *PostgresRepository) GetMetadataFieldsWithContext(ctx context.Context, queryContext *MetadataContext) ([]MetadataFieldSuggestion, error)
func (*PostgresRepository) GetMetadataValues ¶
func (r *PostgresRepository) GetMetadataValues(ctx context.Context, field string, prefix string, limit int) ([]MetadataValueSuggestion, error)
func (*PostgresRepository) GetMetadataValuesWithContext ¶
func (r *PostgresRepository) GetMetadataValuesWithContext(ctx context.Context, field string, prefix string, limit int, queryContext *MetadataContext) ([]MetadataValueSuggestion, error)
func (*PostgresRepository) GetMyAssets ¶ added in v0.4.0
func (r *PostgresRepository) GetMyAssets(ctx context.Context, userID string, teamIDs []string, limit, offset int) ([]*Asset, int, error)
GetMyAssets retrieves assets owned by a user or their teams with a single optimized query
func (*PostgresRepository) GetRunHistory ¶ added in v0.3.0
func (r *PostgresRepository) GetRunHistory(ctx context.Context, assetID string, limit, offset int) ([]*RunHistory, int, error)
func (*PostgresRepository) GetRunHistoryHistogram ¶ added in v0.3.0
func (r *PostgresRepository) GetRunHistoryHistogram(ctx context.Context, assetID string, days int) ([]HistogramBucket, error)
func (*PostgresRepository) GetTagSuggestions ¶
func (*PostgresRepository) GetTerms ¶ added in v0.4.0
GetTerms retrieves all glossary terms associated with an asset
func (*PostgresRepository) ListByPattern ¶
func (*PostgresRepository) RemoveTerm ¶ added in v0.4.0
RemoveTerm removes a glossary term association from an asset
func (*PostgresRepository) Search ¶
func (r *PostgresRepository) Search(ctx context.Context, filter SearchFilter, calculateCounts bool) ([]*Asset, int, AvailableFilters, error)
func (*PostgresRepository) Summary ¶
func (r *PostgresRepository) Summary(ctx context.Context) (*AssetSummary, error)
type Repository ¶
type Repository interface {
Create(ctx context.Context, asset *Asset) error
Get(ctx context.Context, id string) (*Asset, error)
GetByMRN(ctx context.Context, qualifiedName string) (*Asset, error)
Search(ctx context.Context, filter SearchFilter, calculateCounts bool) ([]*Asset, int, AvailableFilters, error)
GetMyAssets(ctx context.Context, userID string, teamIDs []string, limit, offset int) ([]*Asset, int, error)
Summary(ctx context.Context) (*AssetSummary, error)
Update(ctx context.Context, asset *Asset) error
Delete(ctx context.Context, id string) error
DeleteByMRN(ctx context.Context, mrn string) error
ListByPattern(ctx context.Context, pattern string, assetType string) ([]*Asset, error)
GetByMRNs(ctx context.Context, mrns []string) ([]*Asset, error)
GetByTypeAndName(ctx context.Context, assetType, name string) (*Asset, error)
GetMetadataFieldsWithContext(ctx context.Context, queryContext *MetadataContext) ([]MetadataFieldSuggestion, error)
GetMetadataValuesWithContext(ctx context.Context, field string, prefix string, limit int, queryContext *MetadataContext) ([]MetadataValueSuggestion, error)
GetMetadataFields(ctx context.Context) ([]MetadataFieldSuggestion, error)
GetMetadataValues(ctx context.Context, field string, prefix string, limit int) ([]MetadataValueSuggestion, error)
GetTagSuggestions(ctx context.Context, prefix string, limit int) ([]string, error)
GetRunHistory(ctx context.Context, assetID string, limit, offset int) ([]*RunHistory, int, error)
GetRunHistoryHistogram(ctx context.Context, assetID string, days int) ([]HistogramBucket, error)
AddTerms(ctx context.Context, assetID string, termIDs []string, source string, createdBy string) error
RemoveTerm(ctx context.Context, assetID string, termID string) error
GetTerms(ctx context.Context, assetID string) ([]AssetTerm, error)
GetAssetsByTerm(ctx context.Context, termID string, limit, offset int) ([]*Asset, int, error)
}
type RunHistory ¶ added in v0.3.0
type RunHistory struct {
ID string `json:"id"`
RunID string `json:"run_id"`
JobName string `json:"job_name"`
JobNamespace string `json:"job_namespace"`
Status string `json:"status"`
StartTime *time.Time `json:"start_time,omitempty"`
EndTime *time.Time `json:"end_time,omitempty"`
DurationMs *int64 `json:"duration_ms,omitempty"`
Type string `json:"type"`
EventTime time.Time `json:"event_time"`
}
type SearchFilter ¶
type SearchFilter struct {
Query string `json:"query" validate:"omitempty"`
Types []string `json:"types" validate:"omitempty"`
Providers []string `json:"providers" validate:"omitempty"`
Tags []string `json:"tags" validate:"omitempty"`
Limit int `json:"limit" validate:"omitempty,gte=0"`
Offset int `json:"offset" validate:"omitempty,gte=0"`
IncludeStubs bool `json:"include_stubs,omitempty"`
OwnerType *string `json:"owner_type,omitempty"`
OwnerID *string `json:"owner_id,omitempty"`
}
type Service ¶
type Service interface {
Create(ctx context.Context, input CreateInput) (*Asset, error)
Get(ctx context.Context, id string) (*Asset, error)
GetByMRN(ctx context.Context, qualifiedName string) (*Asset, error)
Search(ctx context.Context, filter SearchFilter, calculateCounts bool) ([]*Asset, int, AvailableFilters, error)
GetMyAssets(ctx context.Context, userID string, teamIDs []string, limit, offset int) ([]*Asset, int, error)
Summary(ctx context.Context) (*AssetSummary, error)
Update(ctx context.Context, id string, input UpdateInput) (*Asset, error)
Delete(ctx context.Context, id string) error
DeleteByMRN(ctx context.Context, mrn string) error
AddTag(ctx context.Context, id string, tag string) (*Asset, error)
RemoveTag(ctx context.Context, id string, tag string) (*Asset, error)
ListByPattern(ctx context.Context, pattern string, assetType string) ([]*Asset, error)
GetByMRNs(ctx context.Context, mrns []string) (map[string]*Asset, error)
GetByTypeAndName(ctx context.Context, assetType, name string) (*Asset, error)
GetMetadataFields(ctx context.Context, queryContext *MetadataContext) ([]MetadataFieldSuggestion, error)
GetMetadataValues(ctx context.Context, field string, prefix string, limit int, queryContext *MetadataContext) ([]MetadataValueSuggestion, error)
GetTagSuggestions(ctx context.Context, prefix string, limit int) ([]string, error)
GetRunHistory(ctx context.Context, assetID string, limit, offset int) ([]*RunHistory, int, error)
GetRunHistoryHistogram(ctx context.Context, assetID string, days int) ([]HistogramBucket, error)
AddTerms(ctx context.Context, assetID string, termIDs []string, source string, createdBy string) error
RemoveTerm(ctx context.Context, assetID string, termID string) error
GetTerms(ctx context.Context, assetID string) ([]AssetTerm, error)
GetAssetsByTerm(ctx context.Context, termID string, limit, offset int) ([]*Asset, int, error)
// SetMembershipObserver registers an observer for asset create/delete events.
SetMembershipObserver(observer MembershipObserver)
// SetNotificationObserver registers an observer for asset update notifications.
SetNotificationObserver(observer NotificationObserver)
}
func NewService ¶
func NewService(repo Repository, opts ...ServiceOption) Service
type ServiceOption ¶
type ServiceOption func(*service)
func WithMetrics ¶
func WithMetrics(metrics MetricsClient) ServiceOption
type UpdateInput ¶
type UpdateInput struct {
Name *string `json:"name"`
Description *string `json:"description"`
UserDescription *string `json:"user_description"`
Metadata map[string]interface{} `json:"metadata"`
Type string `json:"type"`
Providers []string `json:"providers"`
Schema map[string]string `json:"schema"`
Tags []string `json:"tags"`
Sources []AssetSource `json:"sources"`
Environments map[string]Environment `json:"environments"`
ExternalLinks []ExternalLink `json:"external_links"`
Query *string `json:"query,omitempty"`
QueryLanguage *string `json:"query_language,omitempty"`
SkipNotification bool `json:"-"`
}
Click to show internal directories.
Click to hide internal directories.