util

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExternalHTTPClient = &http.Client{
	Transport: gzhttp.Transport(externalTr),
	Timeout:   time.Second * 15,
}
View Source
var HTTPClient = &http.Client{
	Transport: gzhttp.Transport(internalTr),
	Timeout:   time.Second * 5,
}

Functions

func CopyHeader

func CopyHeader(dst http.Header, src http.Header)

func DigInvoke

func DigInvoke(function interface{}, opts ...dig.InvokeOption) error

DigInvoke ...

func DigProvide

func DigProvide(constructor interface{}, opts ...dig.ProvideOption) error

DigProvide ...

func RequestCBOR

func RequestCBOR(ctx context.Context, cli *http.Client, method, api string, input, output any) error

func RequestJSON

func RequestJSON(ctx context.Context, cli *http.Client, method, api string, input, output any) error

func StringSliceHas

func StringSliceHas(sl []string, v string) bool

StringSliceHas ...

Types

type ContextHTTPHeader

type ContextHTTPHeader http.Header

type ID

type ID xid.ID
var ANON ID = mustParseID("000000000000000anon0") // anonymous user
var JARVIS ID = mustParseID("0000000000000jarvis0") // system user

func (ID) MarshalCBOR

func (id ID) MarshalCBOR() ([]byte, error)

func (ID) MarshalJSON

func (id ID) MarshalJSON() ([]byte, error)

func (ID) String

func (id ID) String() string

func (*ID) UnmarshalCBOR

func (id *ID) UnmarshalCBOR(data []byte) error

func (*ID) UnmarshalJSON

func (id *ID) UnmarshalJSON(data []byte) error

type UUID

type UUID uuid.UUID

func (UUID) Base64 added in v0.2.0

func (id UUID) Base64() string

func (UUID) MarshalCBOR

func (id UUID) MarshalCBOR() ([]byte, error)

func (UUID) MarshalText

func (id UUID) MarshalText() ([]byte, error)

func (UUID) String

func (id UUID) String() string

func (*UUID) UnmarshalCBOR

func (id *UUID) UnmarshalCBOR(data []byte) error

func (*UUID) UnmarshalText

func (id *UUID) UnmarshalText(data []byte) error

Jump to

Keyboard shortcuts

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