db

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2019 License: Apache-2.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TypeLabel    = "type"
	InsertType   = "insert"
	DeleteType   = "delete"
	ReadType     = "read"
	PingType     = "ping"
	ListReadType = "listRead"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EventType added in v0.3.2

type EventType int
const (
	// default event type
	Default EventType = iota

	// event type for online and offline events
	State
)

func ParseEventType added in v0.3.2

func ParseEventType(event string) EventType

func (EventType) String added in v0.3.2

func (i EventType) String() string

type Inserter added in v0.2.0

type Inserter interface {
	InsertRecords(records ...Record) error
}

type Pruner added in v0.2.0

type Pruner interface {
	GetRecordIDs(shard int, limit int, deathDate int64) ([]int, error)
	PruneRecords(records []int) error
}

type Record added in v0.2.0

type Record struct {
	Type      EventType `json:"type" bson:"type" gorm:"type:int"`
	DeviceID  string    `json:"deviceid" bson:"deviceid"`
	BirthDate int64     `json:"birthdate" bson:"birthdate"`
	DeathDate int64     `json:"deathdate" bson:"deathdate"`
	Data      []byte    `json:"data" bson:"data"`
	Nonce     []byte    `json:"nonce" bson:"nonce"`
	Alg       string    `json:"alg" bson:"alg"`
	KID       string    `json:"kid" bson:"kid" gorm:"Column:kid"`
}

func (Record) TableName added in v0.2.0

func (Record) TableName() string

set Record's table name to be `events`

type RecordGetter added in v0.2.0

type RecordGetter interface {
	GetRecords(deviceID string, limit int) ([]Record, error)
	GetRecordsOfType(deviceID string, limit int, eventType EventType) ([]Record, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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