github.com/altipla-consulting/ravendb-go-client@v0.1.3/get_conflicts_command.go (about) 1 package ravendb 2 3 import ( 4 "net/http" 5 ) 6 7 var ( 8 _ RavenCommand = &GetConflictsCommand{} 9 ) 10 11 type GetConflictsCommand struct { 12 RavenCommandBase 13 14 _id string 15 16 Result *GetConflictsResult 17 } 18 19 func NewGetConflictsCommand(id string) *GetConflictsCommand { 20 panicIf(id == "", "id cannot be empty") 21 cmd := &GetConflictsCommand{ 22 RavenCommandBase: NewRavenCommandBase(), 23 24 _id: id, 25 } 26 cmd.IsReadRequest = true 27 28 return cmd 29 } 30 31 func (c *GetConflictsCommand) createRequest(node *ServerNode) (*http.Request, error) { 32 url := node.URL + "/databases/" + node.Database + "/replication/conflicts?docId=" + c._id 33 34 return newHttpGet(url) 35 } 36 37 func (c *GetConflictsCommand) setResponse(response []byte, fromCache bool) error { 38 if len(response) == 0 { 39 return throwInvalidResponse() 40 } 41 return jsonUnmarshal(response, &c.Result) 42 }