backgroundtasks

package
v0.1.175-herb-ICache-I... Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReflectTypeIBackgroundTasks = di.GetInterfaceReflectType((*IBackgroundTasks)(nil))

ReflectTypeIBackgroundTasks used when your service claims to implement IBackgroundTasks

View Source
var ReflectTypeIJobsProvider = di.GetInterfaceReflectType((*IJobsProvider)(nil))

ReflectTypeIJobsProvider used when your service claims to implement IJobsProvider

Functions

func AddScopedIBackgroundTasks

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

AddScopedIBackgroundTasks adds a type that implements IBackgroundTasks

func AddScopedIBackgroundTasksByFunc

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

AddScopedIBackgroundTasksByFunc adds a type by a custom func

func AddScopedIJobsProvider

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

AddScopedIJobsProvider adds a type that implements IJobsProvider

func AddScopedIJobsProviderByFunc

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

AddScopedIJobsProviderByFunc adds a type by a custom func

func AddSingletonIBackgroundTasks

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

AddSingletonIBackgroundTasks adds a type that implements IBackgroundTasks

func AddSingletonIBackgroundTasksByFunc

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

AddSingletonIBackgroundTasksByFunc adds a type by a custom func

func AddSingletonIBackgroundTasksByObj

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

AddSingletonIBackgroundTasksByObj adds a prebuilt obj

func AddSingletonIJobsProvider

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

AddSingletonIJobsProvider adds a type that implements IJobsProvider

func AddSingletonIJobsProviderByFunc

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

AddSingletonIJobsProviderByFunc adds a type by a custom func

func AddSingletonIJobsProviderByObj

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

AddSingletonIJobsProviderByObj adds a prebuilt obj

func AddTransientIBackgroundTasks

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

AddTransientIBackgroundTasks adds a type that implements IBackgroundTasks

func AddTransientIBackgroundTasksByFunc

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

AddTransientIBackgroundTasksByFunc adds a type by a custom func

func AddTransientIJobsProvider

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

AddTransientIJobsProvider adds a type that implements IJobsProvider

func AddTransientIJobsProviderByFunc

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

AddTransientIJobsProviderByFunc adds a type by a custom func

func RemoveAllIBackgroundTasks added in v0.1.144

func RemoveAllIBackgroundTasks(builder *di.Builder)

RemoveAllIBackgroundTasks removes all IBackgroundTasks from the DI

func RemoveAllIJobsProvider added in v0.1.144

func RemoveAllIJobsProvider(builder *di.Builder)

RemoveAllIJobsProvider removes all IJobsProvider from the DI

Types

type IBackgroundTasks

type IBackgroundTasks interface {
}

IBackgroundTasks ...

func GetIBackgroundTasksFromContainer

func GetIBackgroundTasksFromContainer(ctn di.Container) IBackgroundTasks

GetIBackgroundTasksFromContainer alternative to SafeGetIBackgroundTasksFromContainer but panics of object is not present

func SafeGetIBackgroundTasksFromContainer

func SafeGetIBackgroundTasksFromContainer(ctn di.Container) (IBackgroundTasks, error)

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

type IJobsProvider

type IJobsProvider interface {
	GetScheduledJobs() ScheduledJobs
	GetOneTimeJobs() OneTimeJobs
}

IJobsProvider ...

func GetIJobsProviderFromContainer

func GetIJobsProviderFromContainer(ctn di.Container) IJobsProvider

GetIJobsProviderFromContainer alternative to SafeGetIJobsProviderFromContainer but panics of object is not present

func SafeGetIJobsProviderFromContainer

func SafeGetIJobsProviderFromContainer(ctn di.Container) (IJobsProvider, error)

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

type OneTimeJob

type OneTimeJob struct {
	// Job must support Run() func
	Job   cron.Job
	Delay time.Duration
}

OneTimeJob type

type OneTimeJobs

type OneTimeJobs []*OneTimeJob

OneTimeJobs list

type ScheduledJob

type ScheduledJob struct {
	// Job must support Run() func
	Job cron.Job
	// Schedule "* */5 * * * *","@every 1h30m10s","@midnight"
	Schedule string
}

ScheduledJob cron

type ScheduledJobs

type ScheduledJobs []*ScheduledJob

ScheduledJobs list

Jump to

Keyboard shortcuts

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