Re: [go-nuts] JSON dynamic keys

2018-12-03 Thread Jeffrey Smith
That is 99% of what I'm after cheers. I need to be able to set the _doc bit to be any random string if possible as its the type name. `json:"_doc"` On Monday, December 3, 2018 at 3:53:34 PM UTC, Burak Serdar wrote: > > On Mon, Dec 3, 2018 at 8:27 AM Jeffrey Smith >

[go-nuts] JSON dynamic keys

2018-12-03 Thread Jeffrey Smith
I'm trying to set mapping in elastic search in go and want to generate something like this. { "mappings": { "_doc": { "properties": { "title": { "type": "text", "store": true }, "date": { "type": "date", "store": true }, "content": { "type": "text" } } } } } The _doc, title,date and content a

[go-nuts] dynamic xml

2017-10-18 Thread Jeffrey Smith
I have a lot of XML documents that have sections in that contain tags that can be of any name but will contain type,minOccurs,maxOccurs and have a description inside it. For instance name,description,definition and id below. description number1 user graphCreate API

Re: [go-nuts] Unmarshal multiple similar XML Files

2017-08-31 Thread Jeffrey Smith
Thanks a lot for that, simplifies my code massively :-) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options

[go-nuts] Unmarshal multiple similar XML Files

2017-08-31 Thread Jeffrey Smith
I'm trying to Unmarshal multiple XML files that have differing top level elements but the rest of the document is identical. ... ... I have tried adding multiple tags in the struct but it only ever uses the first one. type EspFlowCodeOperation struct { XMLName xml.Name `xml

[go-nuts] Re: Serve large files

2017-02-28 Thread Jeffrey Smith
).Set("Content-Disposition", "attachment;filename=large.txt") io.Copy(w, streamPDFbytes) } On Tuesday, February 28, 2017 at 11:34:04 AM UTC, Jordan Krage wrote: > > Try using os.Open to get a *File (which implements io.Reader), and then > io.Copy to the response f

[go-nuts] Serve large files

2017-02-28 Thread Jeffrey Smith
I'm trying to server up a file that can be very large so would like to try and stream the content back. package main import ( "bytes" "fmt" //"io" "io/ioutil" "log" "net/http" ) func main() { http.HandleFunc("/", serverFile) if er

[go-nuts] AST to parse contents of Structs

2017-01-27 Thread Jeffrey Smith
I'm trying to use the ast and parse packages to find the fields in two separate structs one that will be called Inputs and the other Outputs. these can change but as an example i'm trying to parse these package main import ( "fmt" ) type Inputs struct { Name string `json:"name"`

[go-nuts] http2 questions

2016-08-10 Thread Jeffrey Smith
I have been playing around with http2 in the latetst 1.7RC today and had a few questions I still had to import "golang.org/x/net/http2" and then set http2.ConfigureTransport to actually use http2 when creating a client. I was under the impression this was fixed or was I wrong? https://github.