core

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PlatFormIos constant is 1 for iOS
	PlatFormIos = iota + 1
	// PlatFormAndroid constant is 2 for Android
	PlatFormAndroid
	// PlatFormHuawei constant is 3 for Huawei
	PlatFormHuawei
)

Backward-compatible integer constants kept as-is.

View Source
const (
	// SucceededPush is log block
	SucceededPush = "succeeded-push"
	// FailedPush is log block
	FailedPush = "failed-push"
)

Log block string constants (backward-compatible)

View Source
const (
	// TotalCountKey is key name for total count of storage
	TotalCountKey = "gorush-total-count"

	// IosSuccessKey is key name or ios success count of storage
	/* #nosec */
	IosSuccessKey = "gorush-ios-success-count"

	// IosErrorKey is key name or ios success error of storage
	IosErrorKey = "gorush-ios-error-count"

	// AndroidSuccessKey is key name for android success count of storage
	AndroidSuccessKey = "gorush-android-success-count"

	// AndroidErrorKey is key name for android error count of storage
	AndroidErrorKey = "gorush-android-error-count"

	// HuaweiSuccessKey is key name for huawei success count of storage
	HuaweiSuccessKey = "gorush-huawei-success-count"

	// HuaweiErrorKey is key name for huawei error count of storage
	HuaweiErrorKey = "gorush-huawei-error-count"
)

Variables

This section is empty.

Functions

func IsLocalQueue

func IsLocalQueue(q Queue) bool

IsLocalQueue check is Local Queue

Types

type Health

type Health interface {
	// Check returns if server is healthy or not
	Check(c context.Context) (bool, error)
}

Health defines a health-check connection.

type LogBlock added in v1.21.0

type LogBlock string

LogBlock is a typed alias for log block kinds.

const (
	LogSucceededPush LogBlock = LogBlock(SucceededPush)
	LogFailedPush    LogBlock = LogBlock(FailedPush)
)

func (LogBlock) IsValid added in v1.21.0

func (l LogBlock) IsValid() bool

IsValid checks a LogBlock value.

type Platform added in v1.21.0

type Platform uint8

Platform is a typed enum for push target platforms. This complements the existing integer constants.

const (
	// Typed equivalents of platform values.
	PlatformIOS     Platform = Platform(PlatFormIos)
	PlatformAndroid Platform = Platform(PlatFormAndroid)
	PlatformHuawei  Platform = Platform(PlatFormHuawei)
)

func ParsePlatform added in v1.21.0

func ParsePlatform(s string) (Platform, error)

ParsePlatform parses a string (case-insensitive) into a Platform.

func (Platform) IsValid added in v1.21.0

func (p Platform) IsValid() bool

IsValid reports whether the platform value is supported.

func (Platform) MarshalJSON added in v1.21.0

func (p Platform) MarshalJSON() ([]byte, error)

MarshalJSON encodes Platform as a JSON string.

func (Platform) MarshalText added in v1.21.0

func (p Platform) MarshalText() ([]byte, error)

MarshalText encodes Platform as its string form.

func (Platform) String added in v1.21.0

func (p Platform) String() string

String returns a stable lowercase name for the platform.

func (*Platform) UnmarshalJSON added in v1.21.0

func (p *Platform) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes Platform from a JSON string or legacy number.

func (*Platform) UnmarshalText added in v1.21.0

func (p *Platform) UnmarshalText(text []byte) error

UnmarshalText decodes Platform from its string form.

type Queue

type Queue string

Queue as backend

var (
	// LocalQueue for channel in Go
	LocalQueue Queue = "local"
	// NSQ a realtime distributed messaging platform
	NSQ Queue = "nsq"
	// NATS Connective Technology for Adaptive Edge & Distributed Systems
	NATS Queue = "nats"
	// Redis Pub/Sub
	Redis Queue = "redis"
)

type Storage

type Storage interface {
	Init() error
	Add(key string, count int64)
	Set(key string, count int64)
	Get(key string) int64
	Close() error
}

Storage interface

Jump to

Keyboard shortcuts

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