bosun.org@v0.0.0-20210513094433-e25bc3e69a1f/annotate/backend/backend.go (about)

     1  package backend
     2  
     3  import (
     4  	"fmt"
     5  	"time"
     6  
     7  	"bosun.org/annotate"
     8  )
     9  
    10  type Backend interface {
    11  	InsertAnnotation(a *annotate.Annotation) error
    12  	GetAnnotation(id string) (*annotate.Annotation, bool, error)
    13  	GetAnnotations(start, end *time.Time, filters ...FieldFilter) (annotate.Annotations, error)
    14  	DeleteAnnotation(id string) error
    15  	GetFieldValues(field string) ([]string, error)
    16  	InitBackend() error
    17  }
    18  
    19  const docType = "annotation"
    20  
    21  var unInitErr = fmt.Errorf("backend has not been initialized")
    22  
    23  type FieldFilter struct {
    24  	Field string
    25  	Verb  string
    26  	Not   bool
    27  	Value string
    28  }
    29  
    30  const Is = "Is"
    31  const Empty = "Empty"