Documentation ¶
Index ¶
Constants ¶
View Source
const ( PlatformIOS = sns.PlatformAPNS PlatformIOSSandbox = sns.PlatformAPNSSandbox PlatformAndroid = sns.PlatformGCM )
Platform supported for a Device.
View Source
const (
// DefaultLanguage for devices.
DefaultLanguage = "en"
)
Variables ¶
View Source
var (
ErrInvalidDevice = errors.New("invalid device")
)
Common errors for Device serive implementations and validations.
Functions ¶
func IsInvalidDevice ¶
IsInvalidDevice indicates if err is ErrInvalidDevice.
Types ¶
type Device ¶
type Device struct { Deleted bool DeviceID string Disabled bool EndpointARN string ID uint64 Language string Platform sns.Platform Token string UserID uint64 CreatedAt time.Time UpdatedAt time.Time }
Device represents a physical device like mobile phone or tablet of a user.
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error wraps common Device errors.
type QueryOptions ¶
type QueryOptions struct { Deleted *bool DeviceIDs []string Disabled *bool EndpointARNs []string IDs []uint64 Platforms []sns.Platform Tokens []string UserIDs []uint64 }
QueryOptions is used to narrow-down user queries.
type Service ¶
type Service interface { service.Lifecycle Count(namespace string, opts QueryOptions) (uint, error) Put(namespace string, device *Device) (*Device, error) Query(namespace string, opts QueryOptions) (List, error) }
Service for device interactions.
func PostgresService ¶
PostgresService returns a Postgres based Service implementation.
type ServiceMiddleware ¶
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 aspects of Service operations and exposes Prometheus metrics.
func LogServiceMiddleware ¶
func LogServiceMiddleware(logger log.Logger, store string) ServiceMiddleware
LogServiceMiddleware given a Logger wraps the next Service with logging capabilities.
Click to show internal directories.
Click to hide internal directories.