fleet/server/kolide/datastore.go
Victor Vrantchan 9d49dbc465 change the implementation of ErrNotFound and AlreadyExists to a struct type (#665)
with an exposed interface.

Not checking for a specific sentinel error reduces coupling between packages
and allows adding context like the resource ID and resource type.
2016-12-20 13:35:22 -05:00

33 lines
591 B
Go

package kolide
// Datastore combines all the interfaces in the Kolide DAL
type Datastore interface {
UserStore
QueryStore
CampaignStore
PackStore
LabelStore
HostStore
PasswordResetStore
SessionStore
AppConfigStore
InviteStore
ScheduledQueryStore
Name() string
Drop() error
Migrate() error
}
// NotFoundError is returned when the datastore resource cannot be found.
type NotFoundError interface {
error
IsNotFound() bool
}
// AlreadyExists is returned when creating a datastore resource that already
// exists.
type AlreadyExistsError interface {
error
IsExists() bool
}