github.com/Finschia/finschia-sdk@v0.48.1/types/result_easyjson.go (about)

     1  // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
     2  
     3  package types
     4  
     5  import (
     6  	json "encoding/json"
     7  
     8  	easyjson "github.com/mailru/easyjson"
     9  	jlexer "github.com/mailru/easyjson/jlexer"
    10  	jwriter "github.com/mailru/easyjson/jwriter"
    11  )
    12  
    13  // suppress unused package warning
    14  var (
    15  	_ *json.RawMessage
    16  	_ *jlexer.Lexer
    17  	_ *jwriter.Writer
    18  	_ easyjson.Marshaler
    19  )
    20  
    21  func easyjsonD3b49167DecodeGithubComLineLbmSdkV2Types(in *jlexer.Lexer, out *ABCIMessageLogs) {
    22  	isTopLevel := in.IsStart()
    23  	if in.IsNull() {
    24  		in.Skip()
    25  		*out = nil
    26  	} else {
    27  		in.Delim('[')
    28  		if *out == nil {
    29  			if !in.IsDelim(']') {
    30  				*out = make(ABCIMessageLogs, 0, 1)
    31  			} else {
    32  				*out = ABCIMessageLogs{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 ABCIMessageLog
    39  			easyjsonD3b49167DecodeGithubComLineLbmSdkV2Types1(in, &v1)
    40  			*out = append(*out, v1)
    41  			in.WantComma()
    42  		}
    43  		in.Delim(']')
    44  	}
    45  	if isTopLevel {
    46  		in.Consumed()
    47  	}
    48  }
    49  func easyjsonD3b49167EncodeGithubComLineLbmSdkV2Types(out *jwriter.Writer, in ABCIMessageLogs) {
    50  	if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
    51  		out.RawString("null")
    52  	} else {
    53  		out.RawByte('[')
    54  		for v2, v3 := range in {
    55  			if v2 > 0 {
    56  				out.RawByte(',')
    57  			}
    58  			easyjsonD3b49167EncodeGithubComLineLbmSdkV2Types1(out, v3)
    59  		}
    60  		out.RawByte(']')
    61  	}
    62  }
    63  
    64  // MarshalJSON supports json.Marshaler interface
    65  func (v ABCIMessageLogs) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjsonD3b49167EncodeGithubComLineLbmSdkV2Types(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v ABCIMessageLogs) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjsonD3b49167EncodeGithubComLineLbmSdkV2Types(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *ABCIMessageLogs) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjsonD3b49167DecodeGithubComLineLbmSdkV2Types(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *ABCIMessageLogs) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjsonD3b49167DecodeGithubComLineLbmSdkV2Types(l, v)
    86  }
    87  func easyjsonD3b49167DecodeGithubComLineLbmSdkV2Types1(in *jlexer.Lexer, out *ABCIMessageLog) {
    88  	isTopLevel := in.IsStart()
    89  	if in.IsNull() {
    90  		if isTopLevel {
    91  			in.Consumed()
    92  		}
    93  		in.Skip()
    94  		return
    95  	}
    96  	in.Delim('{')
    97  	for !in.IsDelim('}') {
    98  		key := in.UnsafeFieldName(false)
    99  		in.WantColon()
   100  		if in.IsNull() {
   101  			in.Skip()
   102  			in.WantComma()
   103  			continue
   104  		}
   105  		switch key {
   106  		case "msg_index":
   107  			out.MsgIndex = uint32(in.Uint32())
   108  		case "log":
   109  			out.Log = string(in.String())
   110  		case "events":
   111  			if in.IsNull() {
   112  				in.Skip()
   113  				out.Events = nil
   114  			} else {
   115  				in.Delim('[')
   116  				if out.Events == nil {
   117  					if !in.IsDelim(']') {
   118  						out.Events = make(StringEvents, 0, 1)
   119  					} else {
   120  						out.Events = StringEvents{}
   121  					}
   122  				} else {
   123  					out.Events = (out.Events)[:0]
   124  				}
   125  				for !in.IsDelim(']') {
   126  					var v4 StringEvent
   127  					easyjsonD3b49167DecodeGithubComLineLbmSdkV2Types2(in, &v4)
   128  					out.Events = append(out.Events, v4)
   129  					in.WantComma()
   130  				}
   131  				in.Delim(']')
   132  			}
   133  		default:
   134  			in.SkipRecursive()
   135  		}
   136  		in.WantComma()
   137  	}
   138  	in.Delim('}')
   139  	if isTopLevel {
   140  		in.Consumed()
   141  	}
   142  }
   143  func easyjsonD3b49167EncodeGithubComLineLbmSdkV2Types1(out *jwriter.Writer, in ABCIMessageLog) {
   144  	out.RawByte('{')
   145  	first := true
   146  	_ = first
   147  	if in.MsgIndex != 0 {
   148  		const prefix string = ",\"msg_index\":"
   149  		first = false
   150  		out.RawString(prefix[1:])
   151  		out.Uint32(uint32(in.MsgIndex))
   152  	}
   153  	if in.Log != "" {
   154  		const prefix string = ",\"log\":"
   155  		if first {
   156  			first = false
   157  			out.RawString(prefix[1:])
   158  		} else {
   159  			out.RawString(prefix)
   160  		}
   161  		out.String(string(in.Log))
   162  	}
   163  	{
   164  		const prefix string = ",\"events\":"
   165  		if first {
   166  			first = false
   167  			out.RawString(prefix[1:])
   168  		} else {
   169  			out.RawString(prefix)
   170  		}
   171  		if in.Events == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
   172  			out.RawString("null")
   173  		} else {
   174  			out.RawByte('[')
   175  			for v5, v6 := range in.Events {
   176  				if v5 > 0 {
   177  					out.RawByte(',')
   178  				}
   179  				easyjsonD3b49167EncodeGithubComLineLbmSdkV2Types2(out, v6)
   180  			}
   181  			out.RawByte(']')
   182  		}
   183  	}
   184  	out.RawByte('}')
   185  }
   186  func easyjsonD3b49167DecodeGithubComLineLbmSdkV2Types2(in *jlexer.Lexer, out *StringEvent) {
   187  	isTopLevel := in.IsStart()
   188  	if in.IsNull() {
   189  		if isTopLevel {
   190  			in.Consumed()
   191  		}
   192  		in.Skip()
   193  		return
   194  	}
   195  	in.Delim('{')
   196  	for !in.IsDelim('}') {
   197  		key := in.UnsafeFieldName(false)
   198  		in.WantColon()
   199  		if in.IsNull() {
   200  			in.Skip()
   201  			in.WantComma()
   202  			continue
   203  		}
   204  		switch key {
   205  		case "type":
   206  			out.Type = string(in.String())
   207  		case "attributes":
   208  			if in.IsNull() {
   209  				in.Skip()
   210  				out.Attributes = nil
   211  			} else {
   212  				in.Delim('[')
   213  				if out.Attributes == nil {
   214  					if !in.IsDelim(']') {
   215  						out.Attributes = make([]Attribute, 0, 2)
   216  					} else {
   217  						out.Attributes = []Attribute{}
   218  					}
   219  				} else {
   220  					out.Attributes = (out.Attributes)[:0]
   221  				}
   222  				for !in.IsDelim(']') {
   223  					var v7 Attribute
   224  					easyjsonD3b49167DecodeGithubComLineLbmSdkV2Types3(in, &v7)
   225  					out.Attributes = append(out.Attributes, v7)
   226  					in.WantComma()
   227  				}
   228  				in.Delim(']')
   229  			}
   230  		default:
   231  			in.SkipRecursive()
   232  		}
   233  		in.WantComma()
   234  	}
   235  	in.Delim('}')
   236  	if isTopLevel {
   237  		in.Consumed()
   238  	}
   239  }
   240  func easyjsonD3b49167EncodeGithubComLineLbmSdkV2Types2(out *jwriter.Writer, in StringEvent) {
   241  	out.RawByte('{')
   242  	first := true
   243  	_ = first
   244  	if in.Type != "" {
   245  		const prefix string = ",\"type\":"
   246  		first = false
   247  		out.RawString(prefix[1:])
   248  		out.String(string(in.Type))
   249  	}
   250  	{
   251  		const prefix string = ",\"attributes\":"
   252  		if first {
   253  			first = false
   254  			out.RawString(prefix[1:])
   255  		} else {
   256  			out.RawString(prefix)
   257  		}
   258  		if in.Attributes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
   259  			out.RawString("null")
   260  		} else {
   261  			out.RawByte('[')
   262  			for v8, v9 := range in.Attributes {
   263  				if v8 > 0 {
   264  					out.RawByte(',')
   265  				}
   266  				easyjsonD3b49167EncodeGithubComLineLbmSdkV2Types3(out, v9)
   267  			}
   268  			out.RawByte(']')
   269  		}
   270  	}
   271  	out.RawByte('}')
   272  }
   273  func easyjsonD3b49167DecodeGithubComLineLbmSdkV2Types3(in *jlexer.Lexer, out *Attribute) {
   274  	isTopLevel := in.IsStart()
   275  	if in.IsNull() {
   276  		if isTopLevel {
   277  			in.Consumed()
   278  		}
   279  		in.Skip()
   280  		return
   281  	}
   282  	in.Delim('{')
   283  	for !in.IsDelim('}') {
   284  		key := in.UnsafeFieldName(false)
   285  		in.WantColon()
   286  		if in.IsNull() {
   287  			in.Skip()
   288  			in.WantComma()
   289  			continue
   290  		}
   291  		switch key {
   292  		case "key":
   293  			out.Key = string(in.String())
   294  		case "value":
   295  			out.Value = string(in.String())
   296  		default:
   297  			in.SkipRecursive()
   298  		}
   299  		in.WantComma()
   300  	}
   301  	in.Delim('}')
   302  	if isTopLevel {
   303  		in.Consumed()
   304  	}
   305  }
   306  func easyjsonD3b49167EncodeGithubComLineLbmSdkV2Types3(out *jwriter.Writer, in Attribute) {
   307  	out.RawByte('{')
   308  	first := true
   309  	_ = first
   310  	if in.Key != "" {
   311  		const prefix string = ",\"key\":"
   312  		first = false
   313  		out.RawString(prefix[1:])
   314  		out.String(string(in.Key))
   315  	}
   316  	if in.Value != "" {
   317  		const prefix string = ",\"value\":"
   318  		if first {
   319  			first = false
   320  			out.RawString(prefix[1:])
   321  		} else {
   322  			out.RawString(prefix)
   323  		}
   324  		out.String(string(in.Value))
   325  	}
   326  	out.RawByte('}')
   327  }