Skip to content

Commit

Permalink
Make some types and functions package private.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickeskov committed Nov 7, 2024
1 parent 47320cf commit fb56f6b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/proto/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3123,12 +3123,12 @@ func (e *DeleteDataEntry) UnmarshalJSON(value []byte) error {
return nil
}

// DataEntryType is the assistive structure used to get the type of DataEntry while unmarshal form JSON.
type DataEntryType struct {
// dataEntryType is the assistive structure used to get the type of DataEntry while unmarshal form JSON.
type dataEntryType struct {
Type string `json:"type"`
}

func GuessDataEntryType(dataEntryType DataEntryType) (DataEntry, error) {
func guessDataEntryType(dataEntryType dataEntryType) (DataEntry, error) {
var r DataEntry
switch dataEntryType.Type {
case "integer":
Expand All @@ -3151,11 +3151,11 @@ func GuessDataEntryType(dataEntryType DataEntryType) (DataEntry, error) {
func NewDataEntryFromJSON(data []byte) (DataEntry, error) {
wrapError := func(err error) error { return errors.Wrap(err, "failed to unmarshal DataEntry from JSON") }

var et DataEntryType
var et dataEntryType
if err := json.Unmarshal(data, &et); err != nil {
return nil, wrapError(err)
}
entry, err := GuessDataEntryType(et)
entry, err := guessDataEntryType(et)
if err != nil {
return nil, wrapError(err)
}
Expand Down Expand Up @@ -3212,15 +3212,15 @@ func (e DataEntries) Valid(forbidEmptyKey, utf16KeyLen bool) error {
func (e *DataEntries) UnmarshalJSON(data []byte) error {
wrapError := func(err error) error { return errors.Wrap(err, "failed to unmarshal DataEntries from JSON") }

var ets []DataEntryType
var ets []dataEntryType
err := json.Unmarshal(data, &ets)
if err != nil {
return wrapError(err)
}

entries := make([]DataEntry, len(ets))
for i, row := range ets {
et, guessErr := GuessDataEntryType(row)
et, guessErr := guessDataEntryType(row)
if guessErr != nil {
return wrapError(guessErr)
}
Expand Down

0 comments on commit fb56f6b

Please sign in to comment.