Skip to content

Commit

Permalink
Migrate first store methods to sqlc
Browse files Browse the repository at this point in the history
  • Loading branch information
neekolas committed Apr 25, 2024
1 parent 5a658b5 commit 003476f
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 118 deletions.
4 changes: 2 additions & 2 deletions pkg/mls/store/queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ WHERE id = @id;

-- name: FetchKeyPackages :many
SELECT id, key_package FROM installations
WHERE ID IN (@ids);
WHERE id = ANY (sqlc.arg(installation_ids)::bytea[]);

-- name: GetIdentityUpdates :many
SELECT * FROM installations
WHERE wallet_address IN (@wallet_addresses)
WHERE wallet_address = ANY (@wallet_addresses::text[])
AND (created_at > @start_time OR revoked_at > @start_time)
ORDER BY created_at ASC;

Expand Down
18 changes: 18 additions & 0 deletions pkg/mls/store/queries/filters.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package queries

import "encoding/json"

type InboxLogFilter struct {
InboxId string `json:"inbox_id"`
SequenceId int64 `json:"sequence_id"`
}

type InboxLogFilterList []InboxLogFilter

func (f *InboxLogFilterList) ToSql() (json.RawMessage, error) {
jsonBytes, err := json.Marshal(f)
if err != nil {
return nil, err
}
return jsonBytes, nil
}
14 changes: 8 additions & 6 deletions pkg/mls/store/queries/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 003476f

Please sign in to comment.