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

Add CRON functions to runtimes #143

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4787,6 +4787,16 @@ declare namespace nkruntime {
*/
channelIdBuild(sender: string, target: string, chanType: ChanType): string

/**
* Parses a CRON expression and a timestamp in UTC seconds, and returns the previous matching timestamp in UTC seconds.
*
* @param cron - The cron expression.
* @param timestamp - UTC unix seconds timestamp.
* @returns The previous cron matching timestamp in UTC seconds.
* @throws {TypeError, GoError}
*/
cronPrev(cron: string, timestamp: number): number

/**
* Parses a CRON expression and a timestamp in UTC seconds, and returns the next matching timestamp in UTC seconds.
*
Expand Down
2 changes: 2 additions & 0 deletions runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,8 @@ type NakamaModule interface {
LinkGoogle(ctx context.Context, userID, token string) error
LinkSteam(ctx context.Context, userID, username, token string, importFriends bool) error

CronPrev(expression string, timestamp int64) (int64, error)
CronNext(expression string, timestamp int64) (int64, error)
ReadFile(path string) (*os.File, error)

UnlinkApple(ctx context.Context, userID, token string) error
Expand Down
Loading