a5gapi

package
v0.0.0-...-35a760b Latest Latest
Warning

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

Go to latest
Published: May 8, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIErr

type APIErr struct {
	Code     uint64 `json:"code"`
	Err      error  `json:"message,omitempty"`
	Public   bool   `json:"-"`
	Severity uint64 `json:"-"`
}

func NewJSONMsgDefautlDebugs

func NewJSONMsgDefautlDebugs(errs ...error) []*APIErr

func NewJSONMsgDefautlErrors

func NewJSONMsgDefautlErrors(errs ...error) []*APIErr

func NewJSONMsgDefautlFatals

func NewJSONMsgDefautlFatals(errs ...error) []*APIErr

func NewJSONMsgDefautlInfos

func NewJSONMsgDefautlInfos(errs ...error) []*APIErr

func NewJSONMsgDefautlPanics

func NewJSONMsgDefautlPanics(errs ...error) []*APIErr

func NewJSONMsgDefautlWarns

func NewJSONMsgDefautlWarns(errs ...error) []*APIErr

func (*APIErr) Error

func (e *APIErr) Error() string

func (*APIErr) MarshalJSON

func (e *APIErr) MarshalJSON() ([]byte, error)

func (*APIErr) UnmarshalJSON

func (e *APIErr) UnmarshalJSON(b []byte) error

type APIErrCode

type APIErrCode uint64
const (
	ErrCodeDefaultDebug APIErrCode = 1100
	ErrCodeDefaultInfo
	ErrCodeDefaultWarn

	ErrCodeDefaultError APIErrCode = 5100
	ErrCodeDefaultFatal
	ErrCodeDefaultPanic
)

type APIErrs

type APIErrs []*APIErr

func (APIErrs) Errors

func (v APIErrs) Errors() []error

func (APIErrs) First

func (v APIErrs) First() error

func (APIErrs) Last

func (v APIErrs) Last() error

type APIMsg

type APIMsg struct {
	Success bool        `json:"success"`
	Errs    []*APIErr   `json:"messages,omitempty"`
	Payload interface{} `json:"payload,omitempty"`
	Time    uint64      `json:"time,omitempty"`
}

func NewMsg

func NewMsg(
	debugLevel int,
	isSuccess bool,
	responsePayload interface{},
	responseMessenger ResponseMessenger,
	errs ...*APIErr) (*APIMsg, error)

func (*APIMsg) Errors

func (v *APIMsg) Errors() []error

func (*APIMsg) KV

func (a *APIMsg) KV() (KV, error)

type APIMsgRequest

type APIMsgRequest struct {
	Payload interface{} `json:"payload,omitempty"`
	Time    uint64      `json:"time,omitempty"`
}

func NewMsgRequest

func NewMsgRequest(
	responsePayload interface{}) (*APIMsgRequest, error)

type APIMsgResponse

type APIMsgResponse APIMsg

func NewMsgResponse

func NewMsgResponse(
	debugLevel int,
	isSuccess bool,
	responsePayload interface{},
	responseMessenger ResponseMessenger,
	errs ...*APIErr) (*APIMsgResponse, error)

type Conformance

type Conformance struct {
	Name   string             `json:"name"`
	Server *ConformanceServer `json:"server"`
	API    *ConformanceClient `json:"api"`
}

func NewConformance

func NewConformance(
	apiVersion string,
	infrastructureVersion uint64,
	releaseStageName string,
	serverTitle, serverName, serverArchitecture string,
	serverID uint64,
	shardsCount int,
	startedAt string,
	heartbeatMetricsEnabled,
	clientMetricsEnabled bool) (*Conformance, error)

type ConformanceClient

type ConformanceClient struct {
	Version string `json:"version"`
}

type ConformanceServer

type ConformanceServer struct {
	Type                    string `json:"type"`
	ID                      uint64 `json:"id"`
	Version                 uint64 `json:"version"`
	ReleaseStage            string `json:"releaseStage"`
	Sharded                 bool   `json:"sharded,omitempty"`
	ShardsCount             uint64 `json:"shardsCount,omitempty"`
	StartedAt               string `json:"startedAt,omitempty"`
	Architecture            string `json:"architecture"`
	HeartbeatMetricsEnabled bool   `json:"heartbeatMetricsEnabled,omitempty"`
	ClientMetricsEnabled    bool   `json:"clientMetricsEnabled,omitempty"`
}

type ErrSeverity

type ErrSeverity uint64
const (
	ErrSeverityUnknown ErrSeverity = iota
	ErrSeverityDebug
	ErrSeverityInfo
	ErrSeverityWarn
	ErrSeverityError
	ErrSeverityFatal
	ErrSeverityPanic
)

func (ErrSeverity) ErrorDefaultCode

func (v ErrSeverity) ErrorDefaultCode() uint64

func (ErrSeverity) Uint64

func (v ErrSeverity) Uint64() uint64

type KV

type KV map[string]interface{}

KV is an key-values

func NewKV

func NewKV() KV

func (KV) Copy

func (m KV) Copy() KV

func (KV) Err

func (m KV) Err() error

func (KV) Error

func (m KV) Error() string

func (KV) Fields

func (m KV) Fields() []a5gfields.Field

func (KV) KVS

func (m KV) KVS() KVS

func (KV) Merge

func (m KV) Merge(m2 KV)

func (KV) ResponseMessages

func (m KV) ResponseMessages() []*APIErr

func (KV) String

func (m KV) String() string

type KVS

type KVS map[string]string

KVS is an key and values of type string

func NewKVS

func NewKVS() KVS

func (KVS) Copy

func (keyValues KVS) Copy() KVS

func (KVS) Err

func (keyValues KVS) Err() error

func (KVS) Error

func (keyValues KVS) Error() string

func (KVS) Fields

func (m KVS) Fields() []a5gfields.Field

func (KVS) KV

func (keyValues KVS) KV() KV

func (KVS) Merge

func (keyValues KVS) Merge(newKeyValues KVS)

func (KVS) ResponseMessages

func (keyValues KVS) ResponseMessages() []*APIErr

func (KVS) String

func (keyValues KVS) String() string

type KVSValueBoolean

type KVSValueBoolean string
const (
	KVSValBoolTrue  KVSValueBoolean = "true"
	KVSValBoolFalse KVSValueBoolean = "false"
)

func (KVSValueBoolean) String

func (v KVSValueBoolean) String() string

type ResponseMessenger

type ResponseMessenger interface {
	ResponseMessages() []*APIErr
}

type SessionShardPayload

type SessionShardPayload struct {
	UserDataVersion uint64 `json:"userDataVersion,omitempty"`
}

func (*SessionShardPayload) IsUserDataVersionPresent

func (v *SessionShardPayload) IsUserDataVersionPresent() bool

type SessionShardResponse

type SessionShardResponse struct {
	APIMsg
	Payload *SessionShardPayload `json:"payload,omitempty"`
}

func NewSession

func NewSession(
	appLogger a5glogs.Logger,
	requestToShard *http.Request,
	timeoutDuration time.Duration,
	secretKey string) (*SessionShardResponse, error)

Jump to

Keyboard shortcuts

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