Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanSelect ¶
func CanSelect(ch <-chan struct{}) bool
CanSelect is a helper for struct{} channels that checks if the channel can be pulled from in a select statement. It is recommended to use this only for channels whose purpose is signaling (i.e. closing the given channel when something is done, at which point it can always be selected, rather than transmitting actual struct{} values), since using this with actual struct{} values would cause a value to get pulled off the channel and potentially mess up synchronization.
func CommonGRPC ¶
func CommonGRPC() []grpc.DialOption
CommonGRPC returns a set of commonly used GRPC dial options for Anki's cloud services, if any are defined for the current platform.
func NewChanWriter ¶
NewChanWriter returns a wrapper around a []byte channel that turns it into an io.Writer
func SleepSelect ¶
SleepSelect is like calling time.Sleep() with an early exit if the given channel ch is closed. It can be used for situations such as a goroutine wanting to sleep while still responding quickly if it receives a signal from a channel. Returns true if sleep was ended early due to selecting from the channel, false if the sleep completed.
func TimeFuncMs ¶
func TimeFuncMs(function func()) float64
TimeFuncMs returns the time, in milliseconds, required to run the given function
Types ¶
type DoOnce ¶
type DoOnce struct {
// contains filtered or unexported fields
}
DoOnce wraps a sync.Once object, taking a function at initialization time rather than at execution time; that way, if the function to be executed is known in advance for all cases, it can be stored in the object rather than repeated in arguments to Once.Do()
type ErrorListener ¶
type ErrorListener interface {
OnError(error)
}
ErrorListener defines an interface that can be used as a common definition to inject error handlers into dependent modules
type Errors ¶
type Errors struct {
// contains filtered or unexported fields
}
func (*Errors) AppendMulti ¶
type MapCredentials ¶
func AppkeyMetadata ¶
func AppkeyMetadata() MapCredentials
func (MapCredentials) GetRequestMetadata ¶
func (MapCredentials) RequireTransportSecurity ¶
func (r MapCredentials) RequireTransportSecurity() bool