push

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTokenExists   = errors.New("push token already exists")
	ErrTokenNotFound = errors.New("push token not found for data container")
)

Functions

This section is empty.

Types

type Record

type Record struct {
	Id uint64

	DataContainerId user.DataContainerID

	PushToken string
	TokenType TokenType
	IsValid   bool

	AppInstallId *string

	CreatedAt time.Time
}

func (*Record) Clone

func (r *Record) Clone() *Record

func (*Record) CopyTo

func (r *Record) CopyTo(dst *Record)

func (*Record) Validate

func (r *Record) Validate() error

type Store

type Store interface {
	// Put creates a new push token record
	Put(ctx context.Context, record *Record) error

	// MarkAsInvalid marks all entries with the push token as invalid
	MarkAsInvalid(ctx context.Context, pushToken string) error

	// Delete deletes all entries with the push token
	Delete(ctx context.Context, pushToken string) error

	// GetAllValidByDataContainer gets all valid push token records for a given
	// data container.
	GetAllValidByDataContainer(ctx context.Context, id *user.DataContainerID) ([]*Record, error)
}

type TokenType

type TokenType uint8
const (
	TokenTypeUnknown TokenType = iota
	TokenTypeFcmAndroid
	TokenTypeFcmApns
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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