fix(11-05): sync single-statement and plain-transaction writes, type engine status errors
- pin the sync callbacks before gorm:commit_or_rollback_transaction: an After-only anchor is appended past the commit and lagoon's after-commit flush, so single-statement writes never synced - give the gate and the document builder a clean session: Session with NewDB and a Context clones the write's statement, and a later WithContext queried through the written model's table - typesense.StatusError carries method, path and status, never the body - README: sync semantics, the three gates, delete on soft delete, and the SQL re-gate required of SearchIDs callers
This commit is contained in:
@@ -317,6 +317,21 @@ func unwrapURLError(err error) error {
|
||||
|
||||
func ok2xx(code int) bool { return code >= 200 && code < 300 }
|
||||
|
||||
func statusError(method, path string, code int) error {
|
||||
return fmt.Errorf("typesense: %s %s: status %d", method, path, code)
|
||||
// StatusError is a Typesense answer outside 2xx. It carries the method,
|
||||
// path and status, never the answer body, which could echo request data.
|
||||
type StatusError struct {
|
||||
Method string
|
||||
Path string
|
||||
Code int
|
||||
}
|
||||
|
||||
func (e *StatusError) Error() string {
|
||||
return fmt.Sprintf("typesense: %s %s: status %d", e.Method, e.Path, e.Code)
|
||||
}
|
||||
|
||||
// StatusCode returns the HTTP status Typesense answered with.
|
||||
func (e *StatusError) StatusCode() int { return e.Code }
|
||||
|
||||
func statusError(method, path string, code int) error {
|
||||
return &StatusError{Method: method, Path: path, Code: code}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user