Help us shape the future of Go! Take the 2026 Go Developer Survey

gitSensor

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextTimeoutInSeconds = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	Name  string
	Email string
	Date  time.Time
}

Author of commit

type ClientRequest

type ClientRequest struct {
	Method       string
	Path         string
	RequestBody  interface{}
	ResponseBody interface{}
}

type Commit

type Commit struct {
	Hash      *Hash
	Tree      *Tree
	Author    *Author
	Committer *Committer
	Tag       *Tag
	Subject   string
	Body      string
}

Commit data

type Committer

type Committer struct {
	Name  string
	Email string
	Date  time.Time
}

Committer of commit

type FileStat

type FileStat struct {
	Name     string
	Addition int
	Deletion int
}

FileStat stores the status of changes in content of a file.

type FileStats

type FileStats []FileStat

type GitChanges

type GitChanges struct {
	Commits   []*Commit
	FileStats FileStats
}

type GitSensorApiError

type GitSensorApiError struct {
	HttpStatusCode    int    `json:"-"`
	Code              string `json:"code,omitempty"`
	InternalMessage   string `json:"internalMessage,omitempty"`
	UserMessage       string `json:"userMessage,omitempty"`
	UserDetailMessage string `json:"userDetailMessage,omitempty"`
}

type GitSensorClient

type GitSensorClient interface {
	GetReleaseChanges(request *ReleaseChangesRequest) (*GitChanges, error)
}

type GitSensorClientImpl

type GitSensorClientImpl struct {
	// contains filtered or unexported fields
}

func NewGitSensorSession

func NewGitSensorSession(config *GitSensorConfig, logger *zap.SugaredLogger) (session *GitSensorClientImpl, err error)

func (GitSensorClientImpl) GetReleaseChanges

func (session GitSensorClientImpl) GetReleaseChanges(req *ReleaseChangesRequest) (changes *GitChanges, err error)

type GitSensorConfig

type GitSensorConfig struct {
	Url     string `env:"GIT_SENSOR_URL" envDefault:"http://localhost:9999"`
	Timeout int    `env:"GIT_SENSOR_TIMEOUT" envDefault:"0"` // in seconds
}

----------------------impl

func GetGitSensorConfig

func GetGitSensorConfig() (*GitSensorConfig, error)

type GitSensorGrpcClient

type GitSensorGrpcClient interface {
	GetChangesInRelease(ctx context.Context, req *pb.ReleaseChangeRequest) (*GitChanges, error)
}

type GitSensorGrpcClientConfig

type GitSensorGrpcClientConfig struct {
	Url string `env:"GIT_SENSOR_URL" envDefault:"127.0.0.1:7070"`
}

func GetConfig

func GetConfig() (*GitSensorGrpcClientConfig, error)

GetConfig parses and returns GitSensor gRPC client configuration

type GitSensorGrpcClientImpl

type GitSensorGrpcClientImpl struct {
	// contains filtered or unexported fields
}

func NewGitSensorGrpcClientImpl

func NewGitSensorGrpcClientImpl(logger *zap.SugaredLogger, config *GitSensorGrpcClientConfig) *GitSensorGrpcClientImpl

func (*GitSensorGrpcClientImpl) GetChangesInRelease

func (client *GitSensorGrpcClientImpl) GetChangesInRelease(ctx context.Context, req *pb.ReleaseChangeRequest) (
	*GitChanges, error)

type GitSensorResponse

type GitSensorResponse struct {
	Code   int                  `json:"code,omitempty"`
	Status string               `json:"status,omitempty"`
	Result json.RawMessage      `json:"result,omitempty"`
	Errors []*GitSensorApiError `json:"errors,omitempty"`
}

type Hash

type Hash struct {
	Long  string
	Short string
}

Hash of commit

type ReleaseChangesRequest

type ReleaseChangesRequest struct {
	PipelineMaterialId int    `json:"pipelineMaterialId"`
	OldCommit          string `json:"oldCommit"`
	NewCommit          string `json:"newCommit"`
}

type StatusCode

type StatusCode int

func (StatusCode) IsSuccess

func (code StatusCode) IsSuccess() bool

type Tag

type Tag struct {
	Name string
	Date time.Time
}

Tag of commit

type Tree

type Tree struct {
	Long  string
	Short string
}

Tree hash of commit

Jump to

Keyboard shortcuts

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