// MarshalJSON serializes the VindexFunc into a JSON representation.
// It's used for testing and diagnostics.
504427
func (vf *VindexFunc) MarshalJSON() ([]byte, error) {
	v := struct {
		Opcode VindexOpcode
		Fields []*querypb.Field
		Cols   []int
		Vindex string
		Value  sqltypes.PlanValue
	}{
		Opcode: vf.Opcode,
		Fields: vf.Fields,
		Cols:   vf.Cols,
		Vindex: vf.Vindex.String(),
		Value:  vf.Value,
	}
	return json.Marshal(v)
}
113600
func (c *Constant) MarshalJSON() ([]byte, error) {
	return []byte(fmt.Sprintf("\"%s\"", c)), nil
}
991855
func (bvc BindVarCond) MarshalJSON() ([]byte, error) {
	b := bytes.NewBuffer(nil)
	safeEncode(b, `{"Name":`, bvc.name)
	safeEncode(b, `,"OnAbsent":`, bvc.onAbsent)
	if bvc.op != QRNoOp {
		safeEncode(b, `,"OnMismatch":`, bvc.onMismatch)
	}
	safeEncode(b, `,"Operator":`, bvc.op)
	if bvc.op != QRNoOp {
		safeEncode(b, `,"Value":`, bvc.value)
	}
	_, _ = b.WriteString("}")
	return b.Bytes(), nil
}
1231413
func (del *Delete) MarshalJSON() ([]byte, error) {
	var tname, vindexName string
	if del.Table != nil {
		tname = del.Table.Name.String()
	}
	if del.Vindex != nil {
		vindexName = del.Vindex.String()
	}
	marshalDelete := struct {
		Opcode               DeleteOpcode
		Keyspace             *vindexes.Keyspace   `json:",omitempty"`
		Query                string               `json:",omitempty"`
		Vindex               string               `json:",omitempty"`
		Values               []sqltypes.PlanValue `json:",omitempty"`
		Table                string               `json:",omitempty"`
		OwnedVindexQuery     string               `json:",omitempty"`
		MultiShardAutocommit bool                 `json:",omitempty"`
		QueryTimeout         int                  `json:",omitempty"`
	}{
		Opcode:               del.Opcode,
		Keyspace:             del.Keyspace,
		Query:                del.Query,
		Vindex:               vindexName,
		Values:               del.Values,
		Table:                tname,
		OwnedVindexQuery:     del.OwnedVindexQuery,
		MultiShardAutocommit: del.MultiShardAutocommit,
		QueryTimeout:         del.QueryTimeout,
	}
	return jsonutil.MarshalNoEscape(marshalDelete)
}
304827
func (r Raw) MarshalJSON() ([]byte, error) {
	if r == nil {
		return []byte("null"), nil
	}
	return r, nil
}
831359
func (v Feature) MarshalJSON() ([]byte, error) {
	switch int32(v) {
	case 1:
		return ([]byte)("\"SERVICE_GENERATOR\""), nil
	}
	return ([]byte)(strconv.FormatInt(int64(v), 10)), nil
}
1050177
func (c *Constant) MarshalJSON() ([]byte, error) {
	buffer := bytes.NewBufferString(fmt.Sprintf("\"%s\"", c))
	return buffer.Bytes(), nil
}
532862
func (v Annotation) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjson72863a49EncodeGithubComSignalfxGolibTraceFormat3(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
508831
func (e encodable) MarshalJSON() ([]byte, error) {
	return Encode(e.E, e.obj)
}
624417
func (upd *Update) MarshalJSON() ([]byte, error) {
	var tname, vindexName string
	if upd.Table != nil {
		tname = upd.Table.Name.String()
	}
	if upd.Vindex != nil {
		vindexName = upd.Vindex.String()
	}
	marshalUpdate := struct {
		Opcode               UpdateOpcode
		Keyspace             *vindexes.Keyspace              `json:",omitempty"`
		Query                string                          `json:",omitempty"`
		Vindex               string                          `json:",omitempty"`
		Values               []sqltypes.PlanValue            `json:",omitempty"`
		ChangedVindexValues  map[string][]sqltypes.PlanValue `json:",omitempty"`
		Table                string                          `json:",omitempty"`
		OwnedVindexQuery     string                          `json:",omitempty"`
		MultiShardAutocommit bool                            `json:",omitempty"`
		QueryTimeout         int                             `json:",omitempty"`
	}{
		Opcode:               upd.Opcode,
		Keyspace:             upd.Keyspace,
		Query:                upd.Query,
		Vindex:               vindexName,
		Values:               upd.Values,
		ChangedVindexValues:  upd.ChangedVindexValues,
		Table:                tname,
		OwnedVindexQuery:     upd.OwnedVindexQuery,
		MultiShardAutocommit: upd.MultiShardAutocommit,
		QueryTimeout:         upd.QueryTimeout,
	}
	return jsonutil.MarshalNoEscape(marshalUpdate)
}
1007075
func (v CBGravatar) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonB0500db0EncodeGithubComFrancoispqtGojayBenchmarks3(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
865624
func (v Generic) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjson692db02bEncodeGithubComMailgunMailgunGoEvents11(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
1314117
func (gv GroupVersion) MarshalJSON() ([]byte, error) {
	s := gv.String()
	if strings.Count(s, "/") > 1 {
		return []byte{}, fmt.Errorf("illegal GroupVersion %v: contains more than one /", s)
	}
	return json.Marshal(s)
}
899549
func (v ClientInfo) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjsonCce3d1beEncodeGithubComMailgunMailgunGoEvents8(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}
14221
func (sf *ScalarFunction) MarshalJSON() ([]byte, error) {
	buffer := bytes.NewBufferString(fmt.Sprintf("\"%s\"", sf))
	return buffer.Bytes(), nil
}
1212123
func (fc FeatureCollection) MarshalJSON() ([]byte, error) {
	type tempFC FeatureCollection

	c := tempFC{
		Type:     featureCollection,
		BBox:     fc.BBox,
		Features: fc.Features,
	}

	if c.Features == nil {
		c.Features = []*Feature{}
	}
	return json.Marshal(c)
}
1091469
func (i *InstanceID) MarshalJSON() ([]byte, error) {
	return json.Marshal(&struct {
		ID       string            `json:"id"`
		Driver   string            `json:"driver"`
		Service  string            `json:"service"`
		Fields   map[string]string `json:"fields,omitempty"`
		Metadata json.RawMessage   `json:"metadata,omitempty"`
	}{i.ID, i.Driver, i.Service, i.Fields, i.metadata})
}