Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding validation for NewGormLocker and adding an extra option #4

Merged
merged 17 commits into from
Nov 14, 2023
Merged

Adding validation for NewGormLocker and adding an extra option #4

merged 17 commits into from
Nov 14, 2023

Conversation

manuelarte
Copy link
Collaborator

What does this do?

Which issue(s) does this PR fix/relate to?

None

List any changes that modify/break current functionality

Have you included tests for your changes?

There is a test to check that gorm.Db and worker can't be nil/empty

Did you document any new/modified functionality?

  • [x ] Updated example_test.go
  • [x ] Updated README.md

Notes

The struct CronJobLock has defined that worker can't be nil, so it's a good practice to check that when creating the locker that worker field is not empty. Same with *gorm.Db.
I also created another option to just set a different precision, instead of the need to create the job identifier again.

@manuelarte
Copy link
Collaborator Author

@JohnRoesler shall we also validate that the table in which the cron job data is going to be stored also exists?

@JohnRoesler
Copy link
Contributor

@manuelarte yes that seems like a good safety thing to do

@manuelarte manuelarte merged commit 99d7489 into go-co-op:main Nov 14, 2023
3 checks passed
@manuelarte manuelarte deleted the validation branch November 14, 2023 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants