github.com/altipla-consulting/ravendb-go-client@v0.1.3/get_revisions_bin_entry_command.go (about) 1 package ravendb 2 3 import ( 4 "net/http" 5 "strconv" 6 ) 7 8 var ( 9 _ RavenCommand = &GetRevisionsBinEntryCommand{} 10 ) 11 12 type GetRevisionsBinEntryCommand struct { 13 RavenCommandBase 14 15 etag int64 16 pageSize int 17 18 Result *JSONArrayResult 19 } 20 21 func NewGetRevisionsBinEntryCommand(etag int64, pageSize int) *GetRevisionsBinEntryCommand { 22 cmd := &GetRevisionsBinEntryCommand{ 23 RavenCommandBase: NewRavenCommandBase(), 24 25 etag: etag, 26 pageSize: pageSize, 27 } 28 cmd.IsReadRequest = true 29 return cmd 30 } 31 32 func (c *GetRevisionsBinEntryCommand) createRequest(node *ServerNode) (*http.Request, error) { 33 etagStr := i64toa(c.etag) 34 url := node.URL + "/databases/" + node.Database + "/revisions/bin?etag=" + etagStr 35 36 if c.pageSize > 0 { 37 url += "&pageSize=" + strconv.Itoa(c.pageSize) 38 } 39 40 return newHttpGet(url) 41 } 42 43 func (c *GetRevisionsBinEntryCommand) setResponse(response []byte, fromCache bool) error { 44 if len(response) == 0 { 45 return throwInvalidResponse() 46 } 47 48 return jsonUnmarshal(response, &c.Result) 49 }