Skip to content

Commit

Permalink
Add is case insensitive equal to for Text types
Browse files Browse the repository at this point in the history
Change-type: minor
  • Loading branch information
otaviojacobi committed Oct 24, 2024
1 parent 4224010 commit a71dd37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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 insensitive equal to Text2
Synonymous Form: Text2 is case insensitive 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 insensitive equal to': (from, to): EqualsNode => [
'Equals',
['ToLower', from],
['ToLower', 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

0 comments on commit a71dd37

Please sign in to comment.