mirror of
https://github.com/c0re100/gotdlib.git
synced 2026-02-21 20:20:17 +01:00
add list unmarshallers
This commit is contained in:
parent
cc7d37acc2
commit
ec36320d03
5 changed files with 1534 additions and 17 deletions
|
|
@ -46,6 +46,23 @@ func GenerateUnmarshalers(schema *tlparser.Schema, packageName string) []byte {
|
|||
}
|
||||
|
||||
`)
|
||||
|
||||
buf.WriteString(fmt.Sprintf(`func UnmarshalListOf%s(dataList []json.RawMessage) ([]%s, error) {
|
||||
list := []%s{}
|
||||
|
||||
for _, data := range dataList {
|
||||
entity, err := Unmarshal%s(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list = append(list, entity)
|
||||
}
|
||||
|
||||
return list, nil
|
||||
}
|
||||
|
||||
`, tdlibClass.ToGoType(), tdlibClass.ToGoType(), tdlibClass.ToGoType(), tdlibClass.ToGoType()))
|
||||
|
||||
}
|
||||
|
||||
for _, typ := range schema.Types {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue