github.com/ravendb/ravendb-go-client@v0.0.0-20240229102137-4474ee7aa0fa/put_command_data_with_json.go (about) 1 package ravendb 2 3 // PutCommandDataWithJSON represents data for put command with json 4 type PutCommandDataWithJSON struct { 5 *CommandData 6 document map[string]interface{} 7 } 8 9 var _ ICommandData = &PutCommandDataWithJSON{} // verify interface match 10 11 // newPutCommandDataWithJSON returns new PutCommandDataWithJSON 12 func newPutCommandDataWithJSON(id string, changeVector *string, document map[string]interface{}) *PutCommandDataWithJSON { 13 panicIf(document == nil, "Document cannot be nil") 14 15 res := &PutCommandDataWithJSON{ 16 CommandData: &CommandData{ 17 Type: CommandPut, 18 ID: id, 19 ChangeVector: changeVector, 20 }, 21 document: document, 22 } 23 return res 24 } 25 26 func (d *PutCommandDataWithJSON) serialize(conventions *DocumentConventions) (interface{}, error) { 27 js := d.baseJSON() 28 js["Document"] = d.document 29 return js, nil 30 }