Documentation ¶
Index ¶
- Constants
- func AliasHash(alias string) int64
- func AliasHashEncoded(alias string) string
- func AliasHashEncodedf(format string, args ...interface{}) string
- func AliasHashf(format string, args ...interface{}) int64
- func Camel(s string) string
- func Clamp[T Float](v T, minimum T, maximum T) T
- func Clamp01[T Float](v T) T
- func ClampFit[T Float](x T, oldMin T, oldMax T, newMin T, newMax T) T
- func ClampFit01[T Float](x T, newMin T, newMax T) T
- func CtxSlog(ctx context.Context) (logger *slog.Logger, ok bool)
- func CtxWithSlog(ctx context.Context, slog *slog.Logger) context.Context
- func Fit[T Float](x T, oldMin T, oldMax T, newMin T, newMax T) T
- func Fit01[T Float](x T, newMin T, newMax T) T
- func FitMax[T Float](x T, newMax T) T
- func JulianDayToTime(d float64) time.Time
- func JulianDayToTimeStmt(stmt *sqlite.Stmt, param string) time.Time
- func JulianDayToTimestamp(f float64) *timestamppb.Timestamp
- func JulianDayToTimestampStmt(stmt *sqlite.Stmt, param string) *timestamppb.Timestamp
- func JulianNow() float64
- func Kebab(s string) string
- func Lower(s string) string
- func NextEncodedID() string
- func NextID() int64
- func Pascal(s string) string
- func RandIntRange[T Integer](r *rand.Rand, min, max T) T
- func RandNegOneToOneClamped[T Float](r *rand.Rand) T
- func RoundFit01[T Float](x T, newMin T, newMax T) T
- func Snake(s string) string
- func TimeToJulianDay(t time.Time) float64
- func TimestampJulian(ts *timestamppb.Timestamp) float64
- func Upper(s string) string
- func UpsertStream(js nats.JetStreamContext, cfg *nats.StreamConfig) (si *nats.StreamInfo, err error)
- type CasedString
- type CtxErrFunc
- type CtxKey
- type Database
- type EmbeddedNATsServer
- type ErrGroupSeparateCtx
- type ErrGroupSharedCtx
- type Float
- type Integer
- type TxFn
- type TypedIdFunc
- type TypedKV
- func (tkv *TypedKV[T]) All() (out []T, err error)
- func (tkv *TypedKV[T]) Batch(values ...T) (err error)
- func (tkv *TypedKV[T]) Delete(value T) (err error)
- func (tkv *TypedKV[T]) DeleteKey(key string) (err error)
- func (t *TypedKV[T]) Get(key string) (T, uint64, error)
- func (tkv *TypedKV[T]) Keys() ([]string, error)
- func (tkv *TypedKV[T]) Load(keys ...string) (loaded []T, err error)
- func (tkv *TypedKV[T]) Set(value T) (revision uint64, err error)
- func (tkv *TypedKV[T]) Update(value T, last uint64) (revision uint64, err error)
- type TypedNewFunc
Constants ¶
View Source
const (
UnixEpochJulianDay = 2440587.5
)
Variables ¶
This section is empty.
Functions ¶
func AliasHashEncoded ¶
func AliasHashEncodedf ¶
func AliasHashf ¶
func ClampFit01 ¶
func ClampFit01[T Float](x T, newMin T, newMax T) T
func CtxWithSlog ¶ added in v0.0.3
func JulianDayToTime ¶
JulianDayToTime converts a Julian day into a time.Time.
func JulianDayToTimestamp ¶
func JulianDayToTimestamp(f float64) *timestamppb.Timestamp
func JulianDayToTimestampStmt ¶
func JulianDayToTimestampStmt(stmt *sqlite.Stmt, param string) *timestamppb.Timestamp
func NextEncodedID ¶
func NextEncodedID() string
func RandIntRange ¶
func RandNegOneToOneClamped ¶
func RoundFit01 ¶
func RoundFit01[T Float](x T, newMin T, newMax T) T
func TimeToJulianDay ¶
TimeToJulianDay converts a time.Time into a Julian day.
func TimestampJulian ¶
func TimestampJulian(ts *timestamppb.Timestamp) float64
func UpsertStream ¶
func UpsertStream(js nats.JetStreamContext, cfg *nats.StreamConfig) (si *nats.StreamInfo, err error)
Types ¶
type CasedString ¶
type CasedString struct { Original string Pascal string Camel string Snake string Kebab string Upper string Lower string }
func Cased ¶
func Cased(s string) CasedString
type CtxErrFunc ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func NewDatabase ¶
type EmbeddedNATsServer ¶
func NewEmbeddedNATsServer ¶
func NewEmbeddedNATsServer(ctx context.Context, clearData bool) (*EmbeddedNATsServer, error)
func (*EmbeddedNATsServer) Client ¶
func (n *EmbeddedNATsServer) Client() (*nats.Conn, error)
func (*EmbeddedNATsServer) Close ¶
func (n *EmbeddedNATsServer) Close() error
func (*EmbeddedNATsServer) WaitForServer ¶
func (n *EmbeddedNATsServer) WaitForServer()
type ErrGroupSeparateCtx ¶
type ErrGroupSeparateCtx struct {
// contains filtered or unexported fields
}
func NewErrGroupSeparateCtx ¶
func NewErrGroupSeparateCtx() *ErrGroupSeparateCtx
func (*ErrGroupSeparateCtx) Go ¶
func (egc *ErrGroupSeparateCtx) Go(ctx context.Context, funcs ...CtxErrFunc)
func (*ErrGroupSeparateCtx) Wait ¶
func (egc *ErrGroupSeparateCtx) Wait() error
type ErrGroupSharedCtx ¶
type ErrGroupSharedCtx struct {
// contains filtered or unexported fields
}
func NewErrGroupSharedCtx ¶
func NewErrGroupSharedCtx(ctx context.Context, funcs ...CtxErrFunc) *ErrGroupSharedCtx
func (*ErrGroupSharedCtx) Go ¶
func (egc *ErrGroupSharedCtx) Go(funcs ...CtxErrFunc)
func (*ErrGroupSharedCtx) Wait ¶
func (egc *ErrGroupSharedCtx) Wait() error
type TypedIdFunc ¶
type TypedIdFunc[T protoreflect.ProtoMessage] func(T) string
type TypedKV ¶
func UpsertTypedKV ¶
func UpsertTypedKV[T protoreflect.ProtoMessage](js nats.JetStreamContext, cfg *nats.KeyValueConfig, newFn TypedNewFunc[T], idFn TypedIdFunc[T]) (*TypedKV[T], error)
type TypedNewFunc ¶
type TypedNewFunc[T protoreflect.ProtoMessage] func() T
Click to show internal directories.
Click to hide internal directories.