Documentation
¶
Overview ¶
Package dbclient exposes dbclient that used to store gocover results.
kusto.go is the kusto client wrapper of the library "github.com/Azure/azure-kusto-go/kusto"
Index ¶
- Constants
- Variables
- type ClientType
- type CoverageData
- type DBOption
- type DbClient
- type IgnoreProfileData
- type KustoClient
- func (client *KustoClient) StoreCoverageData(ctx context.Context, data *CoverageData) error
- func (client *KustoClient) StoreCoverageDataFromFile(ctx context.Context, data []*CoverageData) error
- func (client *KustoClient) StoreIgnoreProfileData(ctx context.Context, data *IgnoreProfileData) error
- func (client *KustoClient) StoreIgnoreProfileDataFromFile(ctx context.Context, data []*IgnoreProfileData) error
- type KustoOption
Constants ¶
View Source
const (
Separator = ":"
)
Variables ¶
View Source
var ( ErrEnvRequired = errors.New("environment is required for kusto db") ErrFlagRequired = errors.New("flag is required for kusto db") ErrFormatCustomColumn = errors.New("wrong format, kusto custom column format is {column}:{datatype}:{value}") )
View Source
var ErrUnsupportedDBType = errors.New(`supportted type are "Kusto", unsupported DB client type`)
Functions ¶
This section is empty.
Types ¶
type ClientType ¶
type ClientType string
const ( None ClientType = "None" Kusto ClientType = "Kusto" )
type CoverageData ¶ added in v1.0.1
type CoverageData struct {
PreciseTimestamp time.Time `json:"preciseTimestamp"` // time send to db
TotalLines int64 `json:"totalLines"` // total lines of the entire repo/module.
EffectiveLines int64 `json:"effectiveLines"` // the lines for coverage base, total lines - ignored lines
IgnoredLines int64 `json:"ignoredLines"` // the lines ignored.
CoveredLines int64 `json:"coveredLines"` // the lines covered by test
Coverage float64 `json:"coverage"` // unit test coverage, CoveredLines / TotalLines
CoverageWithIgnored float64 `json:"coverageWithIgnorance"` // unit test coverage exclude ignored lines, (CoveredLines - CoveredButIgnoredLines) / EffectiveLines
CoveredButIgnoredLines int64 `json:"coveredButIgnoredLines"` // the lines covered but ignored
CoverageMode string `json:"coverageMode"` // coverage mode, diff or full subcommand
ModulePath string `json:"modulePath"` // module name, which is declared in go.mod
FilePath string `json:"filePath"` // file path for a concrete file or directory
Extra map[string]interface{} // extra data that passing accordingly
}
type DBOption ¶ added in v1.0.0
type DBOption struct {
DataCollectionEnabled bool
DbType ClientType
KustoOption KustoOption
}
func (*DBOption) GetDbClient ¶ added in v1.0.0
func (o *DBOption) GetDbClient(logger logrus.FieldLogger) (DbClient, error)
type DbClient ¶
type DbClient interface {
StoreCoverageDataFromFile(ctx context.Context, data []*CoverageData) error
StoreIgnoreProfileDataFromFile(ctx context.Context, data []*IgnoreProfileData) error
StoreCoverageData(context context.Context, data *CoverageData) error
StoreIgnoreProfileData(context context.Context, data *IgnoreProfileData) error
}
DbClient interface for storing gocover data.
func NewKustoClient ¶
func NewKustoClient(option *KustoOption) (DbClient, error)
type IgnoreProfileData ¶ added in v1.0.1
type IgnoreProfileData struct {
PreciseTimestamp time.Time `json:"preciseTimestamp"` // time send to db
ModulePath string `json:"modulePath"` // module name, which is declared in go.mod
FilePath string `json:"filePath"` // file path for a concrete file
Annotation string `json:"annotation"` // ignore annotation
LineNumber int `json:"lineNumber"` // line number of the annotation in file
StartLine int `json:"startLine"` // start line of ignore block
EndLine int `json:"endLine"` // end line of ignore block
Comments string `json:"comments"` // ignore annotation comments
Contents string `json:"contents"` // ignore annotation contents
IgnoreType string `json:"ignoreType"` // ignore annotation type
Extra map[string]interface{} // extra data that passing accordingly
}
type KustoClient ¶
type KustoClient struct {
// contains filtered or unexported fields
}
KustoClient wraps the kusto ingestor and the extra column data and corresponding mappings.
func (*KustoClient) StoreCoverageData ¶ added in v1.0.1
func (client *KustoClient) StoreCoverageData(ctx context.Context, data *CoverageData) error
func (*KustoClient) StoreCoverageDataFromFile ¶ added in v1.0.4
func (client *KustoClient) StoreCoverageDataFromFile(ctx context.Context, data []*CoverageData) error
func (*KustoClient) StoreIgnoreProfileData ¶ added in v1.0.1
func (client *KustoClient) StoreIgnoreProfileData(ctx context.Context, data *IgnoreProfileData) error
func (*KustoClient) StoreIgnoreProfileDataFromFile ¶ added in v1.0.4
func (client *KustoClient) StoreIgnoreProfileDataFromFile(ctx context.Context, data []*IgnoreProfileData) error
type KustoOption ¶
type KustoOption struct {
UseKusto bool
Endpoint string
Database string
CoverageEvent string
IgnoreEvent string
CustomColumns []string
Logger logrus.FieldLogger
ManagedIdentityResouceID string
// contains filtered or unexported fields
}
KustoOption wraps the credential and kusto server information for building kusto client.
func (*KustoOption) Validate ¶
func (o *KustoOption) Validate() error
Validate checks the validation of the input on kusto option.
Click to show internal directories.
Click to hide internal directories.