(input *plugin.ApiResourceInput)
| 64 | } |
| 65 | |
| 66 | func (self *ModelApiHelper[M]) Post(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) { |
| 67 | model := new(M) |
| 68 | err := DecodeMapStruct(input.Body, model, false) |
| 69 | if err != nil { |
| 70 | return nil, err |
| 71 | } |
| 72 | err = self.dalHelper.Create(model) |
| 73 | if err != nil { |
| 74 | return nil, err |
| 75 | } |
| 76 | model = self.Sanitize(model) |
| 77 | return &plugin.ApiResourceOutput{ |
| 78 | Status: http.StatusCreated, |
| 79 | Body: model, |
| 80 | }, nil |
| 81 | } |
| 82 | |
| 83 | func (self *ModelApiHelper[M]) ExtractPkValues(input *plugin.ApiResourceInput) ([]interface{}, errors.Error) { |
| 84 | pkv := make([]interface{}, len(self.pkPathVarNames)) |
nothing calls this directly
no test coverage detected