-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(keys): add a new field x5t
to the entity keys
#14154
Open
catbro666
wants to merge
5
commits into
master
Choose a base branch
from
fti-6399-keys-entity-adds-x5t
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5f8c21b
feat(keys): add a new field `x5t` to the entity `keys`
catbro666 74d66f7
fix(keys): change to make unique constraint on x5t and set_id
catbro666 971655e
fix(keys): add partial unique index on keys(x5t) when set_id is null
catbro666 a330557
fix(db): migration 025_390_to_3100 was not included
catbro666 c17c142
tests(keys): add admin-api-keys tests
catbro666 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
message: | | ||
Added a new field `x5t` to the entity `keys`. | ||
type: feature | ||
scope: Core |
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 |
---|---|---|
|
@@ -22,4 +22,5 @@ return { | |
"022_350_to_360", | ||
"023_360_to_370", | ||
"024_380_to_390", | ||
"025_390_to_3100", | ||
} |
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 @@ | ||
local Keys = {} | ||
|
||
function Keys:select_by_x5t_set_id(x5t, set_id) | ||
local PAGE_SIZE = 100 | ||
local next_offset = nil | ||
local rows, err | ||
|
||
repeat | ||
rows, err, next_offset = self:page(PAGE_SIZE, next_offset) | ||
if err then | ||
return nil, err | ||
end | ||
for _, row in ipairs(rows) do | ||
if row.x5t == x5t and row.set.id == set_id then | ||
return row | ||
end | ||
end | ||
|
||
until next_offset == nil | ||
|
||
return nil | ||
end | ||
|
||
return Keys |
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,27 @@ | ||
local kong = kong | ||
local fmt = string.format | ||
|
||
local Keys = {} | ||
|
||
function Keys:select_by_x5t_set_id(x5t, set_id) | ||
local qs | ||
if set_id then | ||
qs = fmt( | ||
"SELECT * FROM keys WHERE x5t = %s AND set_id = %s;", | ||
kong.db.connector:escape_literal(x5t), | ||
kong.db.connector:escape_literal(set_id)) | ||
else | ||
qs = fmt( | ||
"SELECT * FROM keys WHERE x5t = %s AND set_id IS NULL;", | ||
kong.db.connector:escape_literal(x5t)) | ||
end | ||
|
||
local res, err = kong.db.connector:query(qs, "read") | ||
if err then | ||
return nil, err | ||
end | ||
|
||
return res and res[1] | ||
end | ||
|
||
return Keys |
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
miswritten?