-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: change request_body and response_body columns to text (#38)
- Loading branch information
Showing
10 changed files
with
57 additions
and
59 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
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,26 +1,11 @@ | ||
package entities | ||
|
||
import ( | ||
"database/sql/driver" | ||
"encoding/json" | ||
) | ||
|
||
type AttemptDetail struct { | ||
ID string `json:"id" db:"id"` | ||
RequestHeaders Headers `json:"request_headers" db:"request_headers"` | ||
RequestBody *string `json:"request_body" db:"request_body"` | ||
ResponseHeaders Headers `json:"response_headers" db:"response_headers"` | ||
ResponseBody *string `json:"response_body" db:"response_body"` | ||
ID string `json:"id" db:"id"` | ||
RequestHeaders Headers `json:"request_headers" db:"request_headers"` | ||
RequestBody *string `json:"request_body" db:"request_body"` | ||
ResponseHeaders *Headers `json:"response_headers" db:"response_headers"` | ||
ResponseBody *string `json:"response_body" db:"response_body"` | ||
|
||
BaseModel | ||
} | ||
|
||
type Headers map[string]string | ||
|
||
func (m *Headers) Scan(src interface{}) error { | ||
return json.Unmarshal(src.([]byte), m) | ||
} | ||
|
||
func (m Headers) Value() (driver.Value, error) { | ||
return json.Marshal(m) | ||
} |
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,2 @@ | ||
ALTER TABLE IF EXISTS ONLY "attempt_details" ALTER COLUMN request_body TYPE JSONB USING request_body::JSONB; | ||
ALTER TABLE IF EXISTS ONLY "attempt_details" ALTER COLUMN response_body TYPE JSONB USING response_body::JSONB; |
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,2 @@ | ||
ALTER TABLE IF EXISTS ONLY "attempt_details" ALTER COLUMN request_body TYPE TEXT; | ||
ALTER TABLE IF EXISTS ONLY "attempt_details" ALTER COLUMN response_body TYPE TEXT; |
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