-
Notifications
You must be signed in to change notification settings - Fork 1
/
misc.go
32 lines (25 loc) · 665 Bytes
/
misc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package commonservice
import (
"context"
"time"
)
// Endpoint type
type Endpoint func(ctx context.Context, request any) (response any, err error)
// Middleware type
type Middleware func(Endpoint) Endpoint
// Configuration interface
type Configuration interface {
SetDefault(key string, value any)
BindEnv(input ...string) error
Set(key string, value any)
Get(key string) any
GetString(key string) string
GetStringSlice(key string) []string
GetBool(key string) bool
GetInt(key string) int
GetInt32(key string) int32
GetInt64(key string) int64
GetFloat64(key string) float64
GetTime(key string) time.Time
GetDuration(key string) time.Duration
}