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 is case insensitively equal to for Text types #111

Merged
merged 1 commit into from
Oct 24, 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
3 changes: 3 additions & 0 deletions Type.sbvr
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ Fact type: Text1 is equal to Text2
Synonymous Form: Text1 equals Text2
Synonymous Form: Text2 equals Text1

Fact type: Text1 is case insensitively equal to Text2
Synonymous Form: Text2 is case insensitively equal to Text1

Fact type: Text1 starts with Text2

Fact type: Text1 ends with Text2
Expand Down
6 changes: 6 additions & 0 deletions src/types/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type {
StartsWithNode,
EndsWithNode,
ContainsNode,
EqualsNode,
} from '@balena/abstract-sql-compiler';
import * as TypeUtils from '../type-utils';

Expand All @@ -27,6 +28,11 @@ export const nativeProperties: TypeUtils.NativeProperties = {
export const nativeFactTypes: TypeUtils.NativeFactTypes = {
Text: {
...TypeUtils.nativeFactTypeTemplates.equality,
'is case insensitively equal to': (from, to): EqualsNode => [
'Equals',
['Lower', from],
['Lower', to],
],
'starts with': (from, to): StartsWithNode => ['StartsWith', from, to],
'ends with': (from, to): EndsWithNode => ['EndsWith', from, to],
contains: (from, to): ContainsNode => ['Contains', from, to],
Expand Down
Loading