Skip to main content
Filter by
Sorted by
Tagged with
3 votes
1 answer
95 views

Consider the following 2 structs: type Struct1 struct { foo string `bson:"foo,omitempty"` bar string `bson:"bar,omitempty"` Struct2 *struct2 `bson:"struct2,omitempty&...
redmamoth's user avatar
  • 107
1 vote
0 answers
109 views

In gnark v0.8.1, We first need to convert those 3 to go-native i.e. we convert them to []byte. I tried implementing Serialize() and DeSerialize(), but I am facing errors. Issue: groth16.Proof is an ...
Anupam Shaw's user avatar
1 vote
1 answer
460 views

Unable to parse nested json into structs objects using go lang I have a nested json string that I want to parse using struct in Go language. The json looks like this {"action":"add"...
Byte's user avatar
  • 47
-2 votes
1 answer
107 views

im working to this code: package main import ( "fmt" "reflect" "github.com/fatih/structtag" ) type Person struct { Name ...
Castracucchi Davide's user avatar
0 votes
2 answers
90 views

I am learning https://www.digitalocean.com/community/tutorials/how-to-use-json-in-go#using-a-struct-to-generate-json (old version of Go). I use go 1.20.1 , Windows 11 x64, GoLand 2022.3.2 . package ...
Vy Do's user avatar
  • 1
1 vote
0 answers
56 views

I am using go struct validator library https://github.com/go-playground/validator to validate struct which is used to decode the request body of a patch request. I want return an error if a specific ...
Asitha's user avatar
  • 57
0 votes
1 answer
192 views

I am trying to call an array of objects from my JSON file but I am always facing an error saying: "cannot unmarshal array into Go value of type config.APPConfig". How can I ensure the ...
Blerni2.0's user avatar
1 vote
2 answers
3k views

I am reading data from multiple tables using JOIN, CONCAT, GROUP_CONCAT, JSON_OBJECT. The data is read into the below mentioned model using gorm. type OrgUserDisPublisherData struct { Disciplines ...
Midhun Kumar's user avatar
0 votes
0 answers
737 views

I am trying to get the output from DB using an inner join with 3 tables say Table A and B. Output Struct type C struct { A A `json:"A"` B B `json:&...
aakash singh's user avatar
0 votes
1 answer
2k views

I have list of array int64 values ids = [{1} {2} {3}] I want to use the above array in db query to filter out the records where ID is not in above ids. SELECT * from table where id not in (1,2,3); I ...
aakash singh's user avatar
0 votes
1 answer
2k views

I writing a golang program which append rule to the file as mentioned below Required format: customRules: custom-rules.yaml: |- - rule: Pod Created in Kube Namespace append: true ...
Sathya's user avatar
  • 89
0 votes
1 answer
2k views

I am working on a Go project with the structure as this: pages (folder) -> faculty (folder) > instructors.go > professors.go generalpages.go (inside pages folder) ...
Patrick's user avatar
  • 488
0 votes
2 answers
764 views

Hi i am process of learning the Go language, and i want to ask how to create empty Object/Struct as domain model data type? i am using Fiber as my framework and here is the example of what i want to ...
Ke Vin's user avatar
  • 3,810
0 votes
1 answer
565 views

I am new to Go, and learning Interfaces and Structs. I am having 2 structs - ServiceSection and SliderSection and I am trying to accomplish the below 2 tasks with each of them- GET the JSON response ...
Rahul Satal's user avatar
  • 2,257
0 votes
2 answers
3k views

I have a structure that looks like this type MediaFile struct { ID string `json:"id"` Secret string `json:"-"` Title ...
BRSwift's user avatar
  • 77
3 votes
1 answer
2k views

The documentation states: Anonymous struct fields are usually marshaled as if their inner exported fields were fields in the outer struct. For examble: type foo struct { Foo1 string `json:"...
Fotiadis M.'s user avatar
4 votes
1 answer
3k views

I am trying to use GoModifyTags but it's not giving me required result. I have installed this as per the instruction but don't know how to implement. Using VScode editor. I am trying to add bson tags ...
Muhammad Tariq's user avatar
6 votes
2 answers
7k views

I have been using Go Validator.v2 for field validations and it works elegantly for my non-struct typed fields. However, when it comes to handling struct-based fields (within the original struct), ...
DevO's user avatar
  • 133
0 votes
1 answer
521 views

type Apis struct { Items []struct { ID string `json:"id"` Name string `json:"name"` Description string `...
Akshitha Dalpethado's user avatar
0 votes
1 answer
411 views

I have data like following { "cars": { "toyota": [ "sedan", "pickup" ], "honda": [ "sedan", "couple", "pickup" ...
wzcwts521's user avatar
-1 votes
1 answer
188 views

type A struct { Name *NameS `json:"name"` } for a struct A,is there a method in reflect that I can find a field by structtag like reflect.ValueOf(&ns) // struct s := ps.Elem() s.FieldByTag("...
curtank's user avatar
  • 710
1 vote
0 answers
1k views

like type User struct { ID int32 `json:"_id"` Week string `json:"week"` } json.Marshal(&User{},true)//omitempty is true will return {} is bson,yaml,sql or ...
curtank's user avatar
  • 710
0 votes
1 answer
996 views

For some of my projects, I have had to use the viper package to use configuration. The package requires you to add the mapstructure:"fieldname" to identify and set your configuration object's fields ...
Ocodenyth's user avatar
-2 votes
1 answer
677 views

I am trying to read the following json objects from the json file. So the number of objects are not predefined, they can be multiple or just one. So I tried making this struct but I am not able to ...
Hrishikesh Bajad's user avatar
1 vote
2 answers
73 views

I have this handler: func (h Handler) makeGetMany(v PeopleInjection) http.HandlerFunc { type RespBody struct { TypeCreatorMeta string `type:"bar",tc_resp_body_type:"true"` } ...
user avatar
6 votes
1 answer
4k views

The following code unmarshal's the "Id", but not the "Hostname". Why? I've been staring at it for long enough now that if it's a typo I know I'll never spot it. Help please. (http://play.golang.org/p/...
Ask Bjørn Hansen's user avatar