Documentation ¶
Overview ¶
Package structfield provides types to track struct field offsets.
Index ¶
- type ID
- type Index
- func (i *Index) Get(id ID) (*Offsets, bool)
- func (i *Index) GetLatestOffset(id ID) (OffsetKey, *version.Version)
- func (i *Index) GetOffset(id ID, ver *version.Version) (OffsetKey, bool)
- func (i *Index) MarshalJSON() ([]byte, error)
- func (i *Index) Put(id ID, offsets *Offsets)
- func (i *Index) PutOffset(id ID, ver *version.Version, offset uint64, valid bool)
- func (i *Index) UnmarshalJSON(data []byte) error
- type OffsetKey
- type Offsets
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ID ¶
type ID struct { // ModPath is the module path containing the struct field package. // // If set to "std", the struct field belongs to the standard Go library. ModPath string // PkgPath package import path containing the struct field. PkgPath string // Struct is the name of the struct containing the field. Struct string // Field is the field name. Field string }
ID is a struct field identifier for an offset.
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index holds all struct field offsets.
func (*Index) Get ¶
Get returns the Offsets and true for an id contained in the Index i. It will return nil and false for any id not contained in i.
func (*Index) GetLatestOffset ¶
GetLatestOffset returns the latest known offset value and version for id contained in the Index i.
func (*Index) GetOffset ¶
GetOffset returns the offset value and true for the version ver of id contained in the Index i. It will return zero and false for any id not contained in i.
func (*Index) MarshalJSON ¶
MarshalJSON marshals i into JSON data.
func (*Index) Put ¶
Put stores offsets in the Index i for id.
Any existing offsets stored for id will be replaced. Use PutOffset if you would like to update existing offsets for id with an offset value.
func (*Index) PutOffset ¶
PutOffset stores the offset value for version ver of id within the Index i.
This will update any existing offsets stored for id with offset. If ver already exists within those offsets it will overwrite that value.
func (*Index) UnmarshalJSON ¶
UnmarshalJSON unmarshals the offset JSON data into i.
type OffsetKey ¶
OffsetKey is the offset of a specific struct field in a specific version. If Valid is false, the offset is not known for the struct field at the specified version.