storage

package
v0.0.0-...-c304809 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2018 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BitsPerWord = 32 << (^uint(0) >> 63)
	MaxInt      = 1<<(BitsPerWord-1) - 1
	MinInt      = -MaxInt - 1
)

Variables

This section is empty.

Functions

func CreateEntry

func CreateEntry(e Entry, tx *sql.Tx, ctx context.Context) error

func CreateProject

func CreateProject(p Project, tx *sql.Tx, ctx context.Context) error

func DeleteEntries

func DeleteEntries(projectId int, publishedMin, publishedMax time.Time, tx *sql.Tx, ctx context.Context) error

func FirstNonEmpty

func FirstNonEmpty(values ...string) string

func IsUniqueViolation

func IsUniqueViolation(err error) bool

func ListProjects

func ListProjects(filterName, filterValue string, projects *[]Project, db *sql.DB, ctx context.Context) error

func OpenDB

func OpenDB(dbUrl string) (*sql.DB, error)

OpenDB opens the database connection according to the context.

func StringToNullable

func StringToNullable(value string) sql.NullString

func Ternary

func Ternary(cond bool, a, b string) string

Types

type ContextMap

type ContextMap map[string]interface{}

func (*ContextMap) Scan

func (c *ContextMap) Scan(src interface{}) error

func (ContextMap) Value

func (c ContextMap) Value() (driver.Value, error)

type Entry

type Entry struct {
	ProjectId    int32      `json:"project_id"`
	Seq          int64      `json:"seq"`
	Published    time.Time  `json:"published"`
	Source       string     `json:"source"`
	Type         string     `json:"type"`
	Actor        string     `json:"actor"`
	Object       string     `json:"object"`
	Target       string     `json:"target"`
	Context      ContextMap `json:"context"`
	Repeated     int32      `json:"repeated"`
	TraceId      string     `json:"trace_id"`
	ParentSpanId string     `json:"parent_span_id"`
	SpanId       string     `json:"span_id"`
}

func ListEntries

func ListEntries(projectId int, seqMin, seqMax int, publishedMin, publishedMax time.Time,
	traceId, spanId, search string, limit int, tx *sql.DB, ctx context.Context) ([]Entry, error)

type Project

type Project struct {
	Id     int32  `json:"id"`
	Name   string `json:"name"`
	Domain string `json:"domain"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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