Documentation
¶
Index ¶
- Constants
- Variables
- func IncreaseMinorVersion(v string) (string, error)
- func NewFilterBuilder() *filterBuilder
- func ParseVersion(v string) (*semver.Version, error)
- type Asset
- type DiscoveryError
- type DiscoveryRepository
- type Filter
- type GroupConfig
- type GroupField
- type GroupResult
- type InvalidError
- type Lineage
- type LineageDirection
- type LineageEdge
- type LineageGraph
- type LineageQuery
- type LineageRepository
- type NodeAttributes
- type NotFoundError
- type Probe
- type ProbesFilter
- type ProbesInfo
- type Repository
- type SearchConfig
- type SearchFilter
- type SearchFlags
- type SearchResult
- type Service
- func (s *Service) AddProbe(ctx context.Context, assetURN string, probe *Probe) error
- func (s *Service) DeleteAsset(ctx context.Context, id string) error
- func (s *Service) GetAllAssets(ctx context.Context, flt Filter, withTotal bool) ([]Asset, uint32, error)
- func (s *Service) GetAssetByID(ctx context.Context, id string) (Asset, error)
- func (s *Service) GetAssetByVersion(ctx context.Context, id, version string) (Asset, error)
- func (s *Service) GetAssetVersionHistory(ctx context.Context, flt Filter, id string) ([]Asset, error)
- func (s *Service) GetLineage(ctx context.Context, urn string, query LineageQuery) (Lineage, error)
- func (s *Service) GetTypes(ctx context.Context, flt Filter) (map[Type]int, error)
- func (s *Service) GroupAssets(ctx context.Context, cfg GroupConfig) (results []GroupResult, err error)
- func (s *Service) SearchAssets(ctx context.Context, cfg SearchConfig) (results []SearchResult, err error)
- func (s *Service) SuggestAssets(ctx context.Context, cfg SearchConfig) (suggestions []string, err error)
- func (s *Service) UpsertAsset(ctx context.Context, ast *Asset, upstreams, downstreams []string) (string, error)
- func (s *Service) UpsertAssetWithoutLineage(ctx context.Context, ast *Asset) (string, error)
- type Type
Constants ¶
const BaseVersion = "0.1"
Variables ¶
var ( ErrEmptyID = errors.New("asset does not have ID") ErrProbeExists = errors.New("asset probe already exists") ErrEmptyURN = errors.New("asset does not have URN") ErrUnknownType = errors.New("unknown type") ErrNilAsset = errors.New("nil asset") )
var AllSupportedTypes = []Type{ TypeTable, TypeJob, TypeDashboard, TypeTopic, TypeFeatureTable, TypeApplication, TypeModel, }
AllSupportedTypes holds a list of all supported types struct
Functions ¶
func IncreaseMinorVersion ¶
IncreaseMinorVersion bumps up the minor version +0.1
func NewFilterBuilder ¶
func NewFilterBuilder() *filterBuilder
func ParseVersion ¶
ParseVersion returns error if version string is not in MAJOR.MINOR format
Types ¶
type Asset ¶
type Asset struct {
ID string `json:"id" diff:"-"`
URN string `json:"urn" diff:"-"`
Type Type `json:"type" diff:"-"`
Service string `json:"service" diff:"-"`
Name string `json:"name" diff:"name"`
Description string `json:"description" diff:"description"`
Data map[string]interface{} `json:"data" diff:"data"`
URL string `json:"url" diff:"url"`
Labels map[string]string `json:"labels" diff:"labels"`
Owners []user.User `json:"owners,omitempty" diff:"owners"`
CreatedAt time.Time `json:"created_at" diff:"-"`
UpdatedAt time.Time `json:"updated_at" diff:"-"`
Version string `json:"version" diff:"-"`
UpdatedBy user.User `json:"updated_by" diff:"-"`
Changelog diff.Changelog `json:"changelog,omitempty" diff:"-"`
Probes []Probe `json:"probes,omitempty"`
}
Asset is a model that wraps arbitrary data with Compass' context
type DiscoveryError ¶
func (DiscoveryError) Error ¶
func (err DiscoveryError) Error() string
type DiscoveryRepository ¶
type DiscoveryRepository interface {
Upsert(context.Context, Asset) error
DeleteByID(ctx context.Context, assetID string) error
DeleteByURN(ctx context.Context, assetURN string) error
Search(ctx context.Context, cfg SearchConfig) (results []SearchResult, err error)
Suggest(ctx context.Context, cfg SearchConfig) (suggestions []string, err error)
GroupAssets(ctx context.Context, cfg GroupConfig) (results []GroupResult, err error)
}
type Filter ¶
type GroupConfig ¶ added in v0.5.4
type GroupConfig struct {
// IncludedFields specifies the fields to return in response
IncludedFields []string
// GroupBy fields to group on
GroupBy []string
// Filters specifies document level values to look for.
// Multiple values can be specified for a single key
Filters SearchFilter
// Number of documents you want in response
Size int
}
GroupConfig represents a group query along with any corresponding filter(s)
type GroupField ¶ added in v0.5.4
type GroupResult ¶ added in v0.5.4
type GroupResult struct {
Fields []GroupField
Assets []Asset
}
type InvalidError ¶
type InvalidError struct {
AssetID string
}
func (InvalidError) Error ¶
func (err InvalidError) Error() string
type Lineage ¶
type Lineage struct {
Edges []LineageEdge `json:"edges"`
NodeAttrs map[string]NodeAttributes `json:"node_attrs"`
}
type LineageDirection ¶
type LineageDirection string
const ( LineageDirectionUpstream LineageDirection = "upstream" LineageDirectionDownstream LineageDirection = "downstream" )
func (LineageDirection) IsValid ¶
func (dir LineageDirection) IsValid() bool
type LineageEdge ¶
type LineageGraph ¶
type LineageGraph []LineageEdge
type LineageQuery ¶
type LineageQuery struct {
Level int
Direction LineageDirection
}
type LineageRepository ¶
type NodeAttributes ¶
type NodeAttributes struct {
Probes ProbesInfo `json:"probes"`
}
type NotFoundError ¶
func (NotFoundError) Error ¶
func (err NotFoundError) Error() string
type Probe ¶
type Probe struct {
ID string `json:"id"`
AssetURN string `json:"asset_urn"`
Status string `json:"status"`
StatusReason string `json:"status_reason"`
Metadata map[string]interface{} `json:"metadata"`
Timestamp time.Time `json:"timestamp"`
CreatedAt time.Time `json:"created_at"`
}
Probe represents a single asset's probe
type ProbesFilter ¶
type ProbesInfo ¶
type ProbesInfo struct {
Latest Probe `json:"latest"`
}
type Repository ¶
type Repository interface {
GetAll(context.Context, Filter) ([]Asset, error)
GetCount(context.Context, Filter) (int, error)
GetByID(ctx context.Context, id string) (Asset, error)
GetByURN(ctx context.Context, urn string) (Asset, error)
GetVersionHistory(ctx context.Context, flt Filter, id string) ([]Asset, error)
GetByVersionWithID(ctx context.Context, id, version string) (Asset, error)
GetByVersionWithURN(ctx context.Context, urn, version string) (Asset, error)
GetTypes(ctx context.Context, flt Filter) (map[Type]int, error)
Upsert(ctx context.Context, ast *Asset) (string, error)
DeleteByID(ctx context.Context, id string) error
DeleteByURN(ctx context.Context, urn string) error
AddProbe(ctx context.Context, assetURN string, probe *Probe) error
GetProbes(ctx context.Context, assetURN string) ([]Probe, error)
GetProbesWithFilter(ctx context.Context, flt ProbesFilter) (map[string][]Probe, error)
}
type SearchConfig ¶
type SearchConfig struct {
// Text to search for
Text string
// Filters specifies document level values to look for.
// Multiple values can be specified for a single key
Filters SearchFilter
// Number of relevant results to return
MaxResults int
// RankBy is a param to rank based on a specific parameter
RankBy string
// Queries is a param to search a resource based on asset's fields
Queries map[string]string
// Flags flags to control the search behavior (e.g. column level search, disable fuzzy, etc)
Flags SearchFlags
// Offset parameter defines the offset from the first result you want to fetch
// Note that MaxResults + Offset can not be more than the `index.max_result_window` index setting in ES cluster, which defaults to 10,000
Offset int
}
SearchConfig represents a search query along with any corresponding filter(s)
type SearchFilter ¶
SearchFilter is a filter intended to be used as a search criteria for operations involving asset search
type SearchFlags ¶ added in v0.5.5
type SearchFlags struct {
EnableHighlight bool
// DisableFuzzy disables fuzziness on search
DisableFuzzy bool
}
SearchFlags is intended to be used as flags to control the search behavior (e.g. column level search, disable fuzzy, enable highlight etc) for operations involving asset search
type SearchResult ¶
type SearchResult struct {
ID string `json:"id"`
URN string `json:"urn"`
Title string `json:"title"`
Type string `json:"type"`
Service string `json:"service"`
Description string `json:"description"`
Labels map[string]string `json:"labels"`
Data map[string]interface{} `json:"data"`
}
SearchResult represents an item/result in a list of search results
func (SearchResult) ToAsset ¶
func (sr SearchResult) ToAsset() Asset
ToAsset returns search result as asset
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(assetRepository Repository, discoveryRepository DiscoveryRepository, lineageRepository LineageRepository) *Service
func (*Service) GetAllAssets ¶
func (*Service) GetAssetByID ¶
func (*Service) GetAssetByVersion ¶
func (*Service) GetAssetVersionHistory ¶
func (*Service) GetLineage ¶
func (*Service) GroupAssets ¶ added in v0.5.4
func (s *Service) GroupAssets(ctx context.Context, cfg GroupConfig) (results []GroupResult, err error)
func (*Service) SearchAssets ¶
func (s *Service) SearchAssets(ctx context.Context, cfg SearchConfig) (results []SearchResult, err error)