mirror of
https://github.com/r3-team/r3.git
synced 2026-04-25 01:48:26 -05:00
33 lines
677 B
Go
33 lines
677 B
Go
package request
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"r3/schema/jsFunction"
|
|
"r3/types"
|
|
|
|
"github.com/gofrs/uuid"
|
|
"github.com/jackc/pgx/v5"
|
|
)
|
|
|
|
func JsFunctionDel_tx(ctx context.Context, tx pgx.Tx, reqJson json.RawMessage) (interface{}, error) {
|
|
|
|
var req struct {
|
|
Id uuid.UUID `json:"id"`
|
|
}
|
|
|
|
if err := json.Unmarshal(reqJson, &req); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, jsFunction.Del_tx(ctx, tx, req.Id)
|
|
}
|
|
|
|
func JsFunctionSet_tx(ctx context.Context, tx pgx.Tx, reqJson json.RawMessage) (interface{}, error) {
|
|
var req types.JsFunction
|
|
|
|
if err := json.Unmarshal(reqJson, &req); err != nil {
|
|
return nil, err
|
|
}
|
|
return nil, jsFunction.Set_tx(ctx, tx, req)
|
|
}
|