Documentation ¶
Index ¶
- Constants
- type AssetModel
- type AssetProbeModel
- type AssetRepository
- func (r *AssetRepository) AddProbe(ctx context.Context, assetURN string, probe *asset.Probe) error
- func (r *AssetRepository) BuildFilterQuery(builder sq.SelectBuilder, flt asset.Filter) sq.SelectBuilder
- func (r *AssetRepository) DeleteByID(ctx context.Context, id string) error
- func (r *AssetRepository) DeleteByQueryExpr(ctx context.Context, queryExpr queryexpr.ExprStr) ([]string, error)
- func (r *AssetRepository) DeleteByURN(ctx context.Context, urn string) error
- func (r *AssetRepository) GetAll(ctx context.Context, flt asset.Filter) ([]asset.Asset, error)
- func (r *AssetRepository) GetByID(ctx context.Context, id string) (asset.Asset, error)
- func (r *AssetRepository) GetByURN(ctx context.Context, urn string) (asset.Asset, error)
- func (r *AssetRepository) GetByVersionWithID(ctx context.Context, id, version string) (asset.Asset, error)
- func (r *AssetRepository) GetByVersionWithURN(ctx context.Context, urn, version string) (asset.Asset, error)
- func (r *AssetRepository) GetCount(ctx context.Context, flt asset.Filter) (int, error)
- func (r *AssetRepository) GetCountByQueryExpr(ctx context.Context, queryExpr queryexpr.ExprStr) (int, error)
- func (r *AssetRepository) GetProbes(ctx context.Context, assetURN string) ([]asset.Probe, error)
- func (r *AssetRepository) GetProbesWithFilter(ctx context.Context, flt asset.ProbesFilter) (map[string][]asset.Probe, error)
- func (r *AssetRepository) GetTypes(ctx context.Context, flt asset.Filter) (map[asset.Type]int, error)
- func (r *AssetRepository) GetVersionHistory(ctx context.Context, flt asset.Filter, id string) ([]asset.Asset, error)
- func (r *AssetRepository) Upsert(ctx context.Context, ast *asset.Asset) (string, error)
- type Client
- type Config
- type DiscussionModel
- type DiscussionRepository
- func (r *DiscussionRepository) Create(ctx context.Context, dsc *discussion.Discussion) (string, error)
- func (r *DiscussionRepository) CreateComment(ctx context.Context, cmt *discussion.Comment) (string, error)
- func (r *DiscussionRepository) DeleteComment(ctx context.Context, cid, did string) error
- func (r *DiscussionRepository) Get(ctx context.Context, did string) (discussion.Discussion, error)
- func (r *DiscussionRepository) GetAll(ctx context.Context, flt discussion.Filter) ([]discussion.Discussion, error)
- func (r *DiscussionRepository) GetAllComments(ctx context.Context, did string, flt discussion.Filter) ([]discussion.Comment, error)
- func (r *DiscussionRepository) GetComment(ctx context.Context, cid, did string) (discussion.Comment, error)
- func (r *DiscussionRepository) Patch(ctx context.Context, dsc *discussion.Discussion) error
- func (r *DiscussionRepository) UpdateComment(ctx context.Context, cmt *discussion.Comment) error
- type JSONMap
- type LineageEdgeModel
- type LineageGraphModel
- type LineageRepository
- func (repo *LineageRepository) DeleteByURN(ctx context.Context, urn string) error
- func (repo *LineageRepository) DeleteByURNs(ctx context.Context, urns []string) error
- func (repo *LineageRepository) GetGraph(ctx context.Context, urn string, query asset.LineageQuery) (asset.LineageGraph, error)
- func (repo *LineageRepository) Upsert(ctx context.Context, urn string, upstreams, downstreams []string) error
- type StarClauses
- type StarRepository
- func (r *StarRepository) Create(ctx context.Context, userID, assetID string) (string, error)
- func (r *StarRepository) Delete(ctx context.Context, userID, assetID string) error
- func (r *StarRepository) GetAllAssetsByUserID(ctx context.Context, flt star.Filter, userID string) ([]asset.Asset, error)
- func (r *StarRepository) GetAssetByUserID(ctx context.Context, userID, assetID string) (asset.Asset, error)
- func (r *StarRepository) GetStargazers(ctx context.Context, flt star.Filter, assetID string) ([]user.User, error)
- type TagJoinTemplateFieldModel
- type TagJoinTemplateFieldModels
- type TagJoinTemplateTagFieldModel
- type TagJoinTemplateTagFieldModels
- type TagModel
- type TagModels
- type TagRepository
- func (r *TagRepository) Create(ctx context.Context, domainTag *tag.Tag) error
- func (r *TagRepository) Delete(ctx context.Context, domainTag tag.Tag) error
- func (r *TagRepository) Read(ctx context.Context, filter tag.Tag) ([]tag.Tag, error)
- func (r *TagRepository) Update(ctx context.Context, domainTag *tag.Tag) error
- type TagTemplateFieldModel
- type TagTemplateFieldModels
- type TagTemplateModel
- type TagTemplateModels
- type TagTemplateRepository
- func (r *TagTemplateRepository) Create(ctx context.Context, templateDomain *tag.Template) error
- func (r *TagTemplateRepository) Delete(ctx context.Context, templateURN string) error
- func (r *TagTemplateRepository) Read(ctx context.Context, templateURN string) ([]tag.Template, error)
- func (r *TagTemplateRepository) ReadAll(ctx context.Context) ([]tag.Template, error)
- func (r *TagTemplateRepository) Update(ctx context.Context, targetURN string, templateDomain *tag.Template) error
- type UserModel
- type UserModels
- type UserRepository
- func (r *UserRepository) Create(ctx context.Context, ud *user.User) (string, error)
- func (r *UserRepository) CreateWithTx(ctx context.Context, tx *sqlx.Tx, ud *user.User) (string, error)
- func (r *UserRepository) GetByEmail(ctx context.Context, email string) (user.User, error)
- func (r *UserRepository) GetByEmailWithTx(ctx context.Context, querier sqlx.QueryerContext, email string) (user.User, error)
- func (r *UserRepository) GetOrInsertByEmail(ctx context.Context, ud *user.User) (string, error)
- func (r *UserRepository) InsertByEmail(ctx context.Context, ud *user.User) (string, error)
Constants ¶
const (
DEFAULT_MAX_RESULT_SIZE = 100
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetModel ¶
type AssetModel struct { ID string `db:"id"` URN string `db:"urn"` Type string `db:"type"` Name string `db:"name"` Service string `db:"service"` Description string `db:"description"` Data JSONMap `db:"data"` URL string `db:"url"` Labels JSONMap `db:"labels"` Version string `db:"version"` UpdatedBy UserModel `db:"updated_by"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` RefreshedAt *time.Time `db:"refreshed_at"` // version specific information Changelog types.JSONText `db:"changelog"` Owners types.JSONText `db:"owners"` }
type AssetProbeModel ¶
type AssetRepository ¶
type AssetRepository struct {
// contains filtered or unexported fields
}
AssetRepository is a type that manages user operation to the primary database
func NewAssetRepository ¶
func NewAssetRepository(c *Client, userRepo *UserRepository, defaultGetMaxSize int, defaultUserProvider string) (*AssetRepository, error)
NewAssetRepository initializes user repository clients
func (*AssetRepository) BuildFilterQuery ¶
func (r *AssetRepository) BuildFilterQuery(builder sq.SelectBuilder, flt asset.Filter) sq.SelectBuilder
BuildFilterQuery retrieves the sql query based on applied filter in the queryString
func (*AssetRepository) DeleteByID ¶
func (r *AssetRepository) DeleteByID(ctx context.Context, id string) error
DeleteByID removes asset using its ID
func (*AssetRepository) DeleteByQueryExpr ¶ added in v0.7.8
func (*AssetRepository) DeleteByURN ¶
func (r *AssetRepository) DeleteByURN(ctx context.Context, urn string) error
func (*AssetRepository) GetByVersionWithID ¶
func (r *AssetRepository) GetByVersionWithID(ctx context.Context, id, version string) (asset.Asset, error)
GetByVersionWithID retrieves the specific asset version
func (*AssetRepository) GetByVersionWithURN ¶
func (*AssetRepository) GetCountByQueryExpr ¶ added in v0.7.8
func (r *AssetRepository) GetCountByQueryExpr(ctx context.Context, queryExpr queryexpr.ExprStr) (int, error)
GetCountByQueryExpr retrieves number of assets for every type based on query expr
func (*AssetRepository) GetProbesWithFilter ¶
func (r *AssetRepository) GetProbesWithFilter(ctx context.Context, flt asset.ProbesFilter) (map[string][]asset.Probe, error)
func (*AssetRepository) GetTypes ¶
func (r *AssetRepository) GetTypes(ctx context.Context, flt asset.Filter) (map[asset.Type]int, error)
GetTypes fetches types with assets count for all available types and returns them as a map[typeName]count
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithDB ¶ added in v0.6.0
func (*Client) ExecQueries ¶
ExecQueries is used for executing list of db query
type Config ¶
type Config struct { Host string `mapstructure:"host" default:"localhost"` Port int `mapstructure:"port" default:"5432"` Name string `mapstructure:"name" default:"postgres"` User string `mapstructure:"user" default:"root"` Password string `mapstructure:"password" default:""` SSLMode string `mapstructure:"sslmode" default:"disable"` }
type DiscussionModel ¶
type DiscussionModel struct { ID string `db:"id"` Title string `db:"title"` Body string `db:"body"` Type string `db:"type"` State string `db:"state"` Owner UserModel `db:"owner"` Labels pq.StringArray `db:"labels"` Assets pq.StringArray `db:"assets"` Assignees pq.StringArray `db:"assignees"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
type DiscussionRepository ¶
type DiscussionRepository struct {
// contains filtered or unexported fields
}
DiscussionRepository is a type that manages discussion operation to the primary database
func NewDiscussionRepository ¶
func NewDiscussionRepository(c *Client, defaultGetMaxSize int) (*DiscussionRepository, error)
NewDiscussionRepository initializes discussion repository clients
func (*DiscussionRepository) Create ¶
func (r *DiscussionRepository) Create(ctx context.Context, dsc *discussion.Discussion) (string, error)
Create inserts a new discussion data
func (*DiscussionRepository) CreateComment ¶
func (r *DiscussionRepository) CreateComment(ctx context.Context, cmt *discussion.Comment) (string, error)
Create adds a new comment to a specific discussion
func (*DiscussionRepository) DeleteComment ¶
func (r *DiscussionRepository) DeleteComment(ctx context.Context, cid, did string) error
Delete removes a comment
func (*DiscussionRepository) Get ¶
func (r *DiscussionRepository) Get(ctx context.Context, did string) (discussion.Discussion, error)
Get returns a specific discussion by id
func (*DiscussionRepository) GetAll ¶
func (r *DiscussionRepository) GetAll(ctx context.Context, flt discussion.Filter) ([]discussion.Discussion, error)
GetAll fetchs all discussion data
func (*DiscussionRepository) GetAllComments ¶
func (r *DiscussionRepository) GetAllComments(ctx context.Context, did string, flt discussion.Filter) ([]discussion.Comment, error)
GetAll fetches all comments of a specific discussion
func (*DiscussionRepository) GetComment ¶
func (r *DiscussionRepository) GetComment(ctx context.Context, cid, did string) (discussion.Comment, error)
Get fetchs a comment
func (*DiscussionRepository) Patch ¶
func (r *DiscussionRepository) Patch(ctx context.Context, dsc *discussion.Discussion) error
Patch will update a field in discussion
func (*DiscussionRepository) UpdateComment ¶
func (r *DiscussionRepository) UpdateComment(ctx context.Context, cmt *discussion.Comment) error
Update updates a comment
type JSONMap ¶
type JSONMap map[string]interface{}
func (JSONMap) MarshalJSON ¶
MarshalJSON to output non base64 encoded []byte
func (*JSONMap) UnmarshalJSON ¶
UnmarshalJSON to deserialize []byte
type LineageEdgeModel ¶
type LineageGraphModel ¶
type LineageGraphModel []LineageEdgeModel
type LineageRepository ¶
type LineageRepository struct {
// contains filtered or unexported fields
}
func NewLineageRepository ¶
func NewLineageRepository(client *Client) (*LineageRepository, error)
NewLineageRepository initializes lineage repository
func (*LineageRepository) DeleteByURN ¶ added in v0.5.3
func (repo *LineageRepository) DeleteByURN(ctx context.Context, urn string) error
func (*LineageRepository) DeleteByURNs ¶ added in v0.7.8
func (repo *LineageRepository) DeleteByURNs(ctx context.Context, urns []string) error
func (*LineageRepository) GetGraph ¶
func (repo *LineageRepository) GetGraph(ctx context.Context, urn string, query asset.LineageQuery) (asset.LineageGraph, error)
GetGraph returns a graph that contains list of relations of a given node
type StarClauses ¶
type StarRepository ¶
type StarRepository struct {
// contains filtered or unexported fields
}
StarRepository is a type that manages star operation to the primary database
func NewStarRepository ¶
func NewStarRepository(c *Client) (*StarRepository, error)
NewStarRepository initializes star repository clients
func (*StarRepository) Delete ¶
func (r *StarRepository) Delete(ctx context.Context, userID, assetID string) error
Delete will delete/unstar a starred asset for a user id
func (*StarRepository) GetAllAssetsByUserID ¶
func (r *StarRepository) GetAllAssetsByUserID(ctx context.Context, flt star.Filter, userID string) ([]asset.Asset, error)
GetAllAssetsByUserID fetch list of assets starred by a user
func (*StarRepository) GetAssetByUserID ¶
func (r *StarRepository) GetAssetByUserID(ctx context.Context, userID, assetID string) (asset.Asset, error)
GetAssetByUserID fetch a specific starred asset by user id
type TagJoinTemplateFieldModel ¶
type TagJoinTemplateFieldModel struct { Template TagTemplateModel `db:"tag_templates"` Field TagTemplateFieldModel `db:"tag_template_fields"` }
TagJoinTemplateFieldModel is a placeholder for joined template and field
type TagJoinTemplateFieldModels ¶
type TagJoinTemplateFieldModels []TagJoinTemplateFieldModel
TagJoinTemplateFieldModels is a slice of placeholder for joined template and field
type TagJoinTemplateTagFieldModel ¶
type TagJoinTemplateTagFieldModel struct { Template TagTemplateModel `db:"tag_templates"` Tag TagModel `db:"tags"` Field TagTemplateFieldModel `db:"tag_template_fields"` }
TemplateField is a placeholder for joined template, tag, and field
type TagJoinTemplateTagFieldModels ¶
type TagJoinTemplateTagFieldModels []TagJoinTemplateTagFieldModel
TagJoinTemplateTagFieldModels is a slice of placeholder for joined template, tag, and field
type TagModel ¶
type TagModel struct { ID uint `db:"id"` Value string `db:"value"` AssetID string `db:"asset_id"` FieldID uint `db:"field_id"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Field TagTemplateFieldModel `db:"-"` }
TagModel is a model for tag value in database table
type TagRepository ¶
type TagRepository struct {
// contains filtered or unexported fields
}
TagRepository is a type that manages tag operation ot the primary database
func NewTagRepository ¶
func NewTagRepository(client *Client) (*TagRepository, error)
NewTagRepository initializes tag repository all methods in tag repository uses passed by reference which will mutate the reference variable in method's argument
type TagTemplateFieldModel ¶
type TagTemplateFieldModel struct { ID uint `db:"id"` URN string `db:"urn"` DisplayName string `db:"display_name"` Description string `db:"description"` DataType string `db:"data_type"` Options *string `db:"options"` Required bool `db:"required"` TemplateURN string `db:"template_urn"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Template TagTemplateModel `db:"-"` }
TagTemplateFieldModel is a model for field tag in database table
type TagTemplateFieldModels ¶
type TagTemplateFieldModels []TagTemplateFieldModel
type TagTemplateModel ¶
type TagTemplateModel struct { URN string `db:"urn"` DisplayName string `db:"display_name"` Description string `db:"description"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Fields TagTemplateFieldModels `db:"-"` }
TagTemplateModel is a model for template database table
type TagTemplateModels ¶
type TagTemplateModels []TagTemplateModel
type TagTemplateRepository ¶
type TagTemplateRepository struct {
// contains filtered or unexported fields
}
TagTemplateRepository is a type that manages template operation to the primary database
func NewTagTemplateRepository ¶
func NewTagTemplateRepository(c *Client) (*TagTemplateRepository, error)
NewTagTemplateRepository initializes template repository clients all methods in template repository uses passed by reference which will mutate the reference variable in method's argument
func (*TagTemplateRepository) Delete ¶
func (r *TagTemplateRepository) Delete(ctx context.Context, templateURN string) error
Delete deletes template and its fields from database
func (*TagTemplateRepository) Read ¶
func (r *TagTemplateRepository) Read(ctx context.Context, templateURN string) ([]tag.Template, error)
Read reads template from database by URN
type UserModel ¶
type UserModel struct { ID sql.NullString `db:"id"` Email sql.NullString `db:"email"` Provider sql.NullString `db:"provider"` CreatedAt sql.NullTime `db:"created_at"` UpdatedAt sql.NullTime `db:"updated_at"` }
type UserModels ¶
type UserModels []UserModel
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
UserRepository is a type that manages user operation to the primary database
func NewUserRepository ¶
func NewUserRepository(c *Client) (*UserRepository, error)
NewUserRepository initializes user repository clients
func (*UserRepository) Create ¶
Create insert a user to the database returns error if email is empty
func (*UserRepository) CreateWithTx ¶
func (r *UserRepository) CreateWithTx(ctx context.Context, tx *sqlx.Tx, ud *user.User) (string, error)
Create insert a user to the database using given transaction as client
func (*UserRepository) GetByEmail ¶
GetByEmail retrieves user by given the email
func (*UserRepository) GetByEmailWithTx ¶ added in v0.5.2
func (r *UserRepository) GetByEmailWithTx(ctx context.Context, querier sqlx.QueryerContext, email string) (user.User, error)
func (*UserRepository) GetOrInsertByEmail ¶ added in v0.7.11
func (*UserRepository) InsertByEmail ¶ added in v0.7.11
InsertByEmail insert a new row if email not found