-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Language/Project name to Named mixin
- Loading branch information
Showing
3 changed files
with
27 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module Mixin { | ||
abstract type Named { | ||
required name: str { | ||
rewrite insert, update using (default::str_clean(.name)); | ||
}; | ||
|
||
index on (default::str_sortable(.name)); | ||
|
||
index fts::index on ( | ||
fts::with_options( | ||
.name, | ||
language := fts::Language.eng, | ||
) | ||
); | ||
} | ||
} | ||
|
||
module default { | ||
function str_clean(string: str) -> optional str | ||
using( | ||
with t := str_trim(string, " \t\r\n") | ||
select t if len(t) > 0 else <str>{} | ||
); | ||
} |