app

package
v0.0.0-...-4347b6b Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NamespaceDefault is the default namespace to isolate top-level data sets.
	NamespaceDefault = "tg"
)

Variables

View Source
var (
	ErrNotFound = errors.New("app not found")
)

Common errors for App services.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound indicates if err is ErrNotFound.

Types

type App

type App struct {
	BackendToken string    `json:"backend_token"`
	Description  string    `json:"description"`
	Enabled      bool      `json:"enabled"`
	ID           uint64    `json:"-"`
	InProduction bool      `json:"in_production"`
	Name         string    `json:"name"`
	Token        string    `json:"token"`
	URL          string    `json:"url"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

App represents an Org owned data container.

func (*App) Limit

func (a *App) Limit() int64

Limit returns the desired rate limit for an Application varied by production state.

func (*App) Namespace

func (a *App) Namespace() string

Namespace is the identifier used to slice and dice data related to a an app.

func (*App) Validate

func (a *App) Validate() error

type Error

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

Error wraps common App errors.

func (Error) Error

func (e Error) Error() string

type List

type List []*App

List is an App collection.

type QueryOptions

type QueryOptions struct {
	Before        time.Time
	BackendTokens []string
	Enabled       *bool
	IDs           []uint64
	InProduction  *bool
	Limit         int
	Tokens        []string
}

QueryOptions are used to narrow down app queries.

type Service

type Service interface {
	service.Lifecycle

	Put(namespace string, app *App) (*App, error)
	Query(namespace string, opts QueryOptions) (List, error)
}

Service for app interactions.

func PostgresService

func PostgresService(db *sqlx.DB) Service

PostgresService returns a Postgres based Service implementation.

type ServiceMiddleware

type ServiceMiddleware func(Service) Service

ServiceMiddleware is a chainable behaviour modifier for Service.

func InstrumentServiceMiddleware

func InstrumentServiceMiddleware(
	component, store string,
	errCount kitmetrics.Counter,
	opCount kitmetrics.Counter,
	opLatency *prometheus.HistogramVec,
) ServiceMiddleware

InstrumentServiceMiddleware observes key apsects of Service operations and exposes Prometheus metrics.

func LogServiceMiddleware

func LogServiceMiddleware(logger log.Logger, store string) ServiceMiddleware

LogServiceMiddleware gien a Logger wraps the next Service with logging capabilities.

Jump to

Keyboard shortcuts

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