-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
527 additions
and
241 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
with name := <str>$name, | ||
address := <str>$address, | ||
schedule := <datetime>$schedule, | ||
host_name := <str>$host_name | ||
|
||
address := <optional str>$address ?? <str>{}, | ||
schedule := <datetime>(<optional str>$schedule ?? <str>{}), | ||
host_name := <str>$host_name, | ||
select ( | ||
insert Event { | ||
name := name, | ||
address := address, | ||
schedule := schedule, | ||
host := assert_single( | ||
(select detached User filter .name = host_name) | ||
host := ( | ||
with u:= assert_single((select User filter .name = host_name)), | ||
select | ||
if exists u then (u) | ||
else if exists host_name then (insert User {name:= host_name}) | ||
else (<User>{}) | ||
) | ||
} | ||
) {name, address, schedule, host: {name}}; | ||
) {name, address, schedule, host: {name}}; |
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
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,4 @@ | ||
with name:= <optional str>$name ?? "%", | ||
name:= "%" ++ <str>$name ++ "%", | ||
users:= (select User filter .name ilike name), | ||
select users.name; |
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,22 @@ | ||
# AUTOGENERATED FROM 'app/queries/search_users_by_name_ilike.edgeql' WITH: | ||
# $ edgedb-py | ||
|
||
|
||
from __future__ import annotations | ||
import edgedb | ||
|
||
|
||
async def search_users_by_name_ilike( | ||
executor: edgedb.AsyncIOExecutor, | ||
*, | ||
name: str | None, | ||
) -> list[str]: | ||
return await executor.query( | ||
"""\ | ||
with name:= <optional str>$name ?? "%", | ||
name:= "%" ++ <str>$name ++ "%", | ||
users:= (select User filter .name ilike name), | ||
select users.name;\ | ||
""", | ||
name=name, | ||
) |
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 |
---|---|---|
@@ -1,15 +1,25 @@ | ||
with name := <str>$name, | ||
new_name := <str>$new_name, | ||
address := <str>$address, | ||
schedule := <datetime>$schedule, | ||
host_name := <str>$host_name | ||
|
||
orig_event := assert_exists(assert_single((select Event filter .name=name))), | ||
orig_event_name:= orig_event.name, | ||
orig_event_address:= orig_event.address, | ||
orig_event_schedule:= orig_event.schedule, | ||
orig_event_host_name:= orig_event.host.name, | ||
new_name := <optional str>$new_name ?? orig_event_name, | ||
address := <optional str>$address ?? orig_event_address, | ||
schedule := <datetime>(<optional str>$schedule) ?? orig_event_schedule, | ||
host_name := <optional str>$host_name ?? orig_event_host_name, | ||
select ( | ||
update Event filter .name = name | ||
set { | ||
name := new_name, | ||
address := address, | ||
schedule := schedule, | ||
host := (select User filter .name = host_name) | ||
host := ( | ||
with u:= assert_single((select detached User filter .name = host_name)), | ||
select | ||
if exists u then (u) | ||
else if exists host_name then (insert User {name:= host_name}) | ||
else (<User>{}) | ||
) | ||
} | ||
) {name, address, schedule, host: {name}}; |
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 |
---|---|---|
|
@@ -22,6 +22,6 @@ module default { | |
} | ||
address : str; | ||
schedule : datetime; | ||
host : User; | ||
required host : User; | ||
} | ||
} |
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
Empty file.
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
Oops, something went wrong.