deleteuser

package
v0.0.0-...-c72f787 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: MIT Imports: 3 Imported by: 0

README

This is a more realistic example of usage for goodjob.

Let's imagine that we have three services that handle user data:

  • Auth - handles authentication and authorization data of users
  • Orders - handles some type of orders created by users
  • Users - handles user profile data

The dummy code for those services' RPC clients is defiled in the dummyservice package.

Now, let's imagine that we want to safe-delete all user data.

We can do it in multiple fashions:

  • call RPC methods to delete user data in each service and hope for the best, i.e. no errors would occur
  • call RPC methods and retry operations that have failed for a reasonable amount of attempts
  • call RPC methods and revert successful operations if one of the operations has failed.
  • or we can do both, retry failed operations and revert unsuccessful ones if some retry threshold is reached.

Examples of all aforementioned approaches can be found here:

Each of those packages contains:

  • job definitions in the job.yaml files
  • generated job boilerplate code in the job.gen.go files
  • tests in the job_test.go files

Tasks for those jobs are in the tasks.go file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SafeDeleteAuthDataTask

type SafeDeleteAuthDataTask struct {
	ID    goodjob.TaskID
	JobID goodjob.JobID
	Args  []*goodjob.TaskArg
}

func (SafeDeleteAuthDataTask) Exec

func (t SafeDeleteAuthDataTask) Exec(args ...*goodjob.TaskArg) (result *goodjob.TaskResult)

func (SafeDeleteAuthDataTask) GetID

func (SafeDeleteAuthDataTask) GetJobID

func (t SafeDeleteAuthDataTask) GetJobID() goodjob.JobID

func (SafeDeleteAuthDataTask) Revert

func (t SafeDeleteAuthDataTask) Revert(args ...*goodjob.TaskArg) (result *goodjob.TaskResult)

type SafeDeleteUserOrdersTask

type SafeDeleteUserOrdersTask struct {
	ID    goodjob.TaskID
	JobID goodjob.JobID
	Args  []*goodjob.TaskArg
}

func (SafeDeleteUserOrdersTask) Exec

func (t SafeDeleteUserOrdersTask) Exec(args ...*goodjob.TaskArg) (result *goodjob.TaskResult)

func (SafeDeleteUserOrdersTask) GetID

func (SafeDeleteUserOrdersTask) GetJobID

func (t SafeDeleteUserOrdersTask) GetJobID() goodjob.JobID

type SafeDeleteUserTask

type SafeDeleteUserTask struct {
	ID    goodjob.TaskID
	JobID goodjob.JobID
	Args  []*goodjob.TaskArg
}

func (SafeDeleteUserTask) Exec

func (t SafeDeleteUserTask) Exec(args ...*goodjob.TaskArg) (result *goodjob.TaskResult)

func (SafeDeleteUserTask) GetID

func (t SafeDeleteUserTask) GetID() goodjob.TaskID

func (SafeDeleteUserTask) GetJobID

func (t SafeDeleteUserTask) GetJobID() goodjob.JobID

func (SafeDeleteUserTask) Revert

func (t SafeDeleteUserTask) Revert(args ...*goodjob.TaskArg) (result *goodjob.TaskResult)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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