timeutils

package
v0.1.189 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReflectTypeITime = di.GetInterfaceReflectType((*ITime)(nil))

ReflectTypeITime used when your service claims to implement ITime

View Source
var ReflectTypeITimeUtils = di.GetInterfaceReflectType((*ITimeUtils)(nil))

ReflectTypeITimeUtils used when your service claims to implement ITimeUtils

View Source
var ReflectTypeTimeNow = reflect.TypeOf(TimeNow(nil))

ReflectTypeTimeNow used when your service claims to implement TimeNow

Functions

func AddScopedITime

func AddScopedITime(builder *di.Builder, implType reflect.Type)

AddScopedITime adds a type that implements ITime

func AddScopedITimeByFunc

func AddScopedITimeByFunc(builder *di.Builder, implType reflect.Type, build func(ctn di.Container) (interface{}, error))

AddScopedITimeByFunc adds a type by a custom func

func AddScopedITimeUtils

func AddScopedITimeUtils(builder *di.Builder, implType reflect.Type)

AddScopedITimeUtils adds a type that implements ITimeUtils

func AddScopedITimeUtilsByFunc

func AddScopedITimeUtilsByFunc(builder *di.Builder, implType reflect.Type, build func(ctn di.Container) (interface{}, error))

AddScopedITimeUtilsByFunc adds a type by a custom func

func AddSingletonITime

func AddSingletonITime(builder *di.Builder, implType reflect.Type)

AddSingletonITime adds a type that implements ITime

func AddSingletonITimeByFunc

func AddSingletonITimeByFunc(builder *di.Builder, implType reflect.Type, build func(ctn di.Container) (interface{}, error))

AddSingletonITimeByFunc adds a type by a custom func

func AddSingletonITimeByObj

func AddSingletonITimeByObj(builder *di.Builder, obj interface{})

AddSingletonITimeByObj adds a prebuilt obj

func AddSingletonITimeUtils

func AddSingletonITimeUtils(builder *di.Builder, implType reflect.Type)

AddSingletonITimeUtils adds a type that implements ITimeUtils

func AddSingletonITimeUtilsByFunc

func AddSingletonITimeUtilsByFunc(builder *di.Builder, implType reflect.Type, build func(ctn di.Container) (interface{}, error))

AddSingletonITimeUtilsByFunc adds a type by a custom func

func AddSingletonITimeUtilsByObj

func AddSingletonITimeUtilsByObj(builder *di.Builder, obj interface{})

AddSingletonITimeUtilsByObj adds a prebuilt obj

func AddTimeNowFunc added in v0.1.187

func AddTimeNowFunc(builder *di.Builder, fnc TimeNow)

AddSingletonTimeNowFunc adds a func to the DI

func AddTransientITime

func AddTransientITime(builder *di.Builder, implType reflect.Type)

AddTransientITime adds a type that implements ITime

func AddTransientITimeByFunc

func AddTransientITimeByFunc(builder *di.Builder, implType reflect.Type, build func(ctn di.Container) (interface{}, error))

AddTransientITimeByFunc adds a type by a custom func

func AddTransientITimeUtils

func AddTransientITimeUtils(builder *di.Builder, implType reflect.Type)

AddTransientITimeUtils adds a type that implements ITimeUtils

func AddTransientITimeUtilsByFunc

func AddTransientITimeUtilsByFunc(builder *di.Builder, implType reflect.Type, build func(ctn di.Container) (interface{}, error))

AddTransientITimeUtilsByFunc adds a type by a custom func

func RemoveAllITime

func RemoveAllITime(builder *di.Builder)

RemoveAllITime removes all ITime from the DI

func RemoveAllITimeUtils

func RemoveAllITimeUtils(builder *di.Builder)

RemoveAllITimeUtils removes all ITimeUtils from the DI

func RemoveAllTimeNowFunc added in v0.1.187

func RemoveAllTimeNowFunc(builder *di.Builder)

RemoveAllTimeNowFunc removes all TimeNow functions from the DI

Types

type ITime

type ITime interface {
	Now() time.Time
}

ITime ...

func GetITimeFromContainer

func GetITimeFromContainer(ctn di.Container) ITime

GetITimeFromContainer alternative to SafeGetITimeFromContainer but panics of object is not present

func GetManyITimeFromContainer added in v0.1.179

func GetManyITimeFromContainer(ctn di.Container) []ITime

GetManyITimeFromContainer alternative to SafeGetManyITimeFromContainer but panics of object is not present

func SafeGetITimeFromContainer

func SafeGetITimeFromContainer(ctn di.Container) (ITime, error)

SafeGetITimeFromContainer trys to get the object by type, will not panic, returns nil and error

func SafeGetManyITimeFromContainer added in v0.1.179

func SafeGetManyITimeFromContainer(ctn di.Container) ([]ITime, error)

SafeGetManyITimeFromContainer trys to get the object by type, will not panic, returns nil and error

type ITimeUtils

type ITimeUtils interface {
	// StartOfMonthUTC where offsetMonth is 0-based (0 = Current Month)
	StartOfMonthUTC(offsetMonth int) time.Time
}

ITimeUtils ...

func GetITimeUtilsFromContainer

func GetITimeUtilsFromContainer(ctn di.Container) ITimeUtils

GetITimeUtilsFromContainer alternative to SafeGetITimeUtilsFromContainer but panics of object is not present

func GetManyITimeUtilsFromContainer added in v0.1.179

func GetManyITimeUtilsFromContainer(ctn di.Container) []ITimeUtils

GetManyITimeUtilsFromContainer alternative to SafeGetManyITimeUtilsFromContainer but panics of object is not present

func SafeGetITimeUtilsFromContainer

func SafeGetITimeUtilsFromContainer(ctn di.Container) (ITimeUtils, error)

SafeGetITimeUtilsFromContainer trys to get the object by type, will not panic, returns nil and error

func SafeGetManyITimeUtilsFromContainer added in v0.1.179

func SafeGetManyITimeUtilsFromContainer(ctn di.Container) ([]ITimeUtils, error)

SafeGetManyITimeUtilsFromContainer trys to get the object by type, will not panic, returns nil and error

type TimeNow added in v0.1.186

type TimeNow func() time.Time

TimeNow ...

func GetManyTimeNowFromContainer added in v0.1.187

func GetManyTimeNowFromContainer(ctn di.Container) []TimeNow

GetManyTimeNowFromContainer alternative to SafeGetManyTimeNowFromContainer but panics of object is not present

func GetTimeNowFromContainer added in v0.1.187

func GetTimeNowFromContainer(ctn di.Container) TimeNow

GetTimeNowFromContainer alternative to SafeGetTimeNowFromContainer but panics of object is not present

func SafeGetManyTimeNowFromContainer added in v0.1.187

func SafeGetManyTimeNowFromContainer(ctn di.Container) ([]TimeNow, error)

SafeGetManyTimeNowFromContainer trys to get the object by type, will not panic, returns nil and error

func SafeGetTimeNowFromContainer added in v0.1.187

func SafeGetTimeNowFromContainer(ctn di.Container) (TimeNow, error)

SafeGetTimeNowFromContainer trys to get the object by type, will not panic, returns nil and error

Jump to

Keyboard shortcuts

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