Documentation ¶
Index ¶
- Constants
- Variables
- func Decode[T any](reader io.Reader) (*T, error)
- func FunctionRetrier[T any](ctx context.Context, fn func() (T, error)) (result T, err error)
- func Unmarshal[T any](data []byte) (*T, error)
- type ContextKey
- type LogEvent
- type Logger
- type LoggerConfig
- type SigninMessage
- type Stream
- type Validator
- type VoteMessage
Constants ¶
View Source
const MAX_RETRIES float64 = 4
Variables ¶
View Source
var ( ContextKeyTraceID = ContextKey("request id") ContextKeyRequestStartTime = ContextKey("request start time") ContextKeyRemoteAddress = ContextKey("request remote address") ContextKeyUser = ContextKey("user") )
Functions ¶
func FunctionRetrier ¶
Invoke a function with exponential backoff when a retryable error is encountered. If fn returns an err that is wrapped in common.ErrRetyable, fn will be retried with exponential backoff. This was originally implemented to solve getting rate limited by the alchemy APIs
See: https://docs.alchemy.com/alchemy/documentation/rate-limits#retries
Types ¶
type ContextKey ¶
type ContextKey string
func (ContextKey) String ¶
func (c ContextKey) String() string
type Logger ¶
type LoggerConfig ¶
type SigninMessage ¶
type SigninMessage struct {
Address string `json:"address"`
}
type Validator ¶
func NewValidator ¶
func NewValidator() Validator
type VoteMessage ¶
type VoteMessage struct { Id int64 `json:"id"` Address string `json:"address"` Type entities.VoteType `json:"type"` Value entities.VoteValue `json:"value"` // the timestamp at which the vote was accepted // this is used to discard old votes that may be processed out of order UpdatedAt int64 `json:"updated_at"` }
Click to show internal directories.
Click to hide internal directories.