LiskArchive / lisk-engine

:bullettrain_front: Lisk blockchain engine
https://lisk.com
Apache License 2.0
0 stars 0 forks source link

Allow codec to use embedded struct #54

Open shuse2 opened 1 year ago

shuse2 commented 1 year ago

Description

For example, below script should be able to produce equivalent outcome of encode/decode when generated.

type Transaction struct {
    SigningTransaction
    ID         codec.Hex   `json:"id"`
    size       int         `json:"-"`
    Signatures []codec.Hex `json:"signatures" fieldNumber:"8"`
}

Motivation

Sometimes, there are multiple version of types needs to be defined. For example, Transaction/Block header has signing block/transaction type and ones with signatures. Currently, they are independent struct, but since properties are the same, it would be nice to be able to declare as an embedded struct

Additional Information