-
Notifications
You must be signed in to change notification settings - Fork 52
Add endsWith
, startsWith
, utcNow
, and uniqueString
functions
#1032
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds four new string and date functions to the DSC library: endsWith
, startsWith
, utcNow
, and uniqueString
. These functions enhance the DSC template expression capabilities with string manipulation and utility operations.
- Implements string prefix/suffix checking with
startsWith
andendsWith
functions - Adds
utcNow
function for date formatting with .NET format string conversion support - Provides
uniqueString
function for generating deterministic hashes from concatenated inputs - Refactors function registration from individual insertions to a vector-based approach for better maintainability
Reviewed Changes
Copilot reviewed 10 out of 13 changed files in this pull request and generated 8 comments.
Show a summary per file
File | Description |
---|---|
dsc_lib/src/functions/ends_with.rs | New function to check if a string ends with a specified suffix |
dsc_lib/src/functions/starts_with.rs | New function to check if a string starts with a specified prefix |
dsc_lib/src/functions/utc_now.rs | New function to get current UTC time with optional .NET format string support |
dsc_lib/src/functions/unique_string.rs | New function to generate deterministic unique strings from input arguments |
dsc_lib/src/functions/mod.rs | Refactored function registration and added new function imports |
dsc_lib/src/configure/context.rs | Added parameter default processing flag to context |
dsc_lib/src/configure/mod.rs | Updated parameter default processing to use context flag |
dsc_lib/locales/en-us.toml | Added localization strings for new functions |
dsc_lib/Cargo.toml | Added dependencies for new functions (base32, murmurhash64) |
dsc/tests/dsc_functions.tests.ps1 | Added comprehensive tests for new functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR Summary
Add
endsWith()
,startsWith()
,utcNow()
, anduniqueString()
functions. Note thatutcNow()
supports a subset of the .NET datetime formatting strings.Also refactored how functions get registered with DSC so that it's from a vector and takes the name from the metadata so no risk of them being out of sync.
PR Context
Part of #976