Skip to content

Commit

Permalink
Merge pull request #6 from ghivert/feat/add-type-search
Browse files Browse the repository at this point in the history
fix: correctly compute indexes
  • Loading branch information
ghivert authored Jul 6, 2024
2 parents cabcbb8 + efadca5 commit 7a148f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/backend/src/backend/gleam/parse.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ fn replace_indexed(
case kind {
Index(name, _) -> {
case dict.get(indexes, name) {
Ok(value) -> #(Index(name, value), #(indexes, current))
Error(_) -> #(Index(name, current), #(
Ok(value) -> #(Index("", value), #(indexes, current))
Error(_) -> #(Index("", current), #(
dict.insert(indexes, name, current),
current + 1,
))
Expand Down
1 change: 1 addition & 0 deletions apps/backend/src/backend/postgres/queries.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ pub fn module_search(db: pgo.Connection, q: String) {
}

pub fn exact_type_search(db: pgo.Connection, q: List(Int)) {
use <- bool.guard(when: list.is_empty(q), return: Ok([]))
let ids =
list.index_map(q, fn(_, idx) { "$" <> int.to_string(idx + 1) })
|> string.join(", ")
Expand Down

0 comments on commit 7a148f8

Please sign in to comment.