dbclient

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: MIT Imports: 12 Imported by: 0

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

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}")
)

Functions

This section is empty.

Types

type ClientType

type ClientType string
const (
	Kusto ClientType = "Kusto"
)

type Data

type Data struct {
	PreciseTimestamp time.Time `json:"preciseTimestamp"` // time send to db
	LinesCovered     int64     `json:"linesCovered"`     // unit test covered lines
	LinesValid       int64     `json:"linesValid"`       // unit test total lines
	Coverage         float64   `json:"coverage"`         // unit test coverage, LinesCovered / LinesValid
	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 DbClient

type DbClient interface {
	Store(context context.Context, data *Data) error
}

DbClient interface for storing gocover data.

func NewKustoClient

func NewKustoClient(option *KustoOption) (DbClient, error)

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) Store

func (client *KustoClient) Store(ctx context.Context, data *Data) error

Store stores the data to kusto.

type KustoOption

type KustoOption struct {
	UseKusto      bool
	Endpoint      string
	Database      string
	Event         string
	CustomColumns []string
	Writer        io.Writer
	// 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.

Jump to

Keyboard shortcuts

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