annotate

package
v0.0.0-...-88d80bb Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Message      = "Message"
	StartDate    = "StartDate"
	EndDate      = "EndDate"
	Source       = "Source"
	Host         = "Host"
	CreationUser = "CreationUser"
	Owner        = "Owner"
	Category     = "Category"
	Url          = "Url"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	AnnotationFields
	StartDate RFC3339
	EndDate   RFC3339
}

func NewAnnotation

func NewAnnotation(id string, start, end time.Time, user, owner, source, host, category, url, message string) (a Annotation)

func (*Annotation) AsEpochAnnotation

func (a *Annotation) AsEpochAnnotation() (ea EpochAnnotation)

func (Annotation) Ask

func (a Annotation) Ask(filter string) (bool, error)

Ask makes it so annotations can be filtered in memory using github.com/kylebrandt/boolq

func (*Annotation) IsOneTimeSet

func (a *Annotation) IsOneTimeSet() bool

func (*Annotation) IsTimeNotSet

func (a *Annotation) IsTimeNotSet() bool

func (*Annotation) MatchTimes

func (a *Annotation) MatchTimes()

Match Times Sets Both times to the greater of the two times

func (*Annotation) SetNow

func (a *Annotation) SetNow()

func (*Annotation) ValidateTime

func (a *Annotation) ValidateTime() error

type AnnotationFields

type AnnotationFields struct {
	Id           string
	Message      string
	CreationUser string
	Url          string
	Source       string
	Host         string
	Owner        string
	Category     string
}

type Annotations

type Annotations []Annotation

func (Annotations) AsEpochAnnotations

func (as Annotations) AsEpochAnnotations() EpochAnnotations

type AnnotationsByStartID

type AnnotationsByStartID Annotations

AnnotationsByStartID is a Type to sort by start time then by id

func (AnnotationsByStartID) Len

func (b AnnotationsByStartID) Len() int

func (AnnotationsByStartID) Less

func (b AnnotationsByStartID) Less(i, j int) bool

func (AnnotationsByStartID) Swap

func (b AnnotationsByStartID) Swap(i, j int)

type Client

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

func NewClient

func NewClient(apiRoot string) Client

func (*Client) GetAnnotation

func (c *Client) GetAnnotation(id string) (*Annotation, error)

GetAnnotation gets an annotation by ID, and will return nil without an error if the annotation does not exist

func (*Client) GetAnnotations

func (c *Client) GetAnnotations(start, end *time.Time, source, host, creationUser, owner, category, url, message string) (Annotations, error)

func (*Client) SendAnnotation

func (c *Client) SendAnnotation(a Annotation) (Annotation, error)

SendAnnotation sends a annotation to an annotations server apiRoot should be "http://foo/api" where the annotation routes would be available at http://foo/api/annotation...

type Epoch

type Epoch struct {
	time.Time
}

func (Epoch) MarshalJSON

func (t Epoch) MarshalJSON() ([]byte, error)

func (*Epoch) UnmarshalJSON

func (t *Epoch) UnmarshalJSON(b []byte) (err error)

type EpochAnnotation

type EpochAnnotation struct {
	AnnotationFields
	StartDate Epoch
	EndDate   Epoch
}

func (*EpochAnnotation) AsAnnotation

func (ea *EpochAnnotation) AsAnnotation() (a Annotation)

type EpochAnnotations

type EpochAnnotations []EpochAnnotation

type RFC3339

type RFC3339 struct {
	time.Time
}

func (RFC3339) MarshalJSON

func (t RFC3339) MarshalJSON() ([]byte, error)

func (*RFC3339) UnmarshalJSON

func (t *RFC3339) UnmarshalJSON(b []byte) (err error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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