// returns true of the type t implements one of the custom marshaler interfaces
423890
func hasCustomMarshaler(t reflect.Type) bool {
	t = reflect.PtrTo(t)
	return t.Implements(reflect.TypeOf((*easyjson.Marshaler)(nil)).Elem()) ||
		t.Implements(reflect.TypeOf((*json.Marshaler)(nil)).Elem()) ||
		t.Implements(reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem())
}
137633
func (t ts) MarshalJSON() ([]byte, error) {
	stringTime := t.Format(time.ANSIC)
	return json.Marshal(stringTime)
}
850263
func (l Traits) MarshalTo(data []byte) (int, error) {
	return l.protoType().MarshalTo(data)
}
1006352
func ImplementsPreJSONMarshaler(v interface{}) bool {
	value := reflect.ValueOf(v)
	if !value.IsValid() {
		return false
	}

	_, ok := value.Interface().(PreJSONMarshaler)
	return ok
}
90283
func (t *Function) MarshalJSON() ([]byte, error) {
	repr := map[string]interface{}{
		"type": t.typeMarker(),
	}
	if len(t.args) > 0 {
		repr["args"] = t.args
	}
	if t.result != nil {
		repr["result"] = t.result
	}
	return json.Marshal(repr)
}
839688
func IsMarshaler(err error) bool {
	_, ok := Cause(err).(MarshalerError)
	return ok
}
898834
func (t Any) MarshalJSON() ([]byte, error) {
	return json.Marshal(map[string]interface{}{
		"type": t.typeMarker(),
		"of":   []Type(t),
	})
}
957868
func (dec *Decoder) isCustomType() (bool, error) {
	if dec.customTypes == nil {
		return false, nil
	}
	if v, ok := dec.customTypes[dec.curr.Type()]; ok {
		if len(v.fields) > 0 {
			for i := range v.fields {
				// check if the current field is registered
				// in the fields of the custom type
				if v.fields[i].field.Elem() == dec.curr {
					va, err := v.fields[i].fun(dec.values)
					if err != nil {
						return true, err
					}
					dec.curr.Set(reflect.ValueOf(va))
					return true, nil
				}
			}
		}
		// check if the default function exists for fields not specific
		if v.fun != nil {
			va, err := v.fun(dec.values)
			if err != nil {
				return true, err
			}
			dec.curr.Set(reflect.ValueOf(va))
			return true, nil
		}
	}
	return false, nil
}
126079
func True(t TestingT, value bool, msgAndArgs ...interface{}) {
	if h, ok := t.(tHelper); ok {
		h.Helper()
	}
	if assert.True(t, value, msgAndArgs...) {
		return
	}
	t.FailNow()
}
111172
func isTextType(t string) bool {
	return t == "text" ||
		t == "json" ||
		t == "" ||
		strings.HasPrefix(t, "varchar") ||
		strings.HasPrefix(t, "varying character") ||
		strings.HasPrefix(t, "nchar") ||
		strings.HasPrefix(t, "native character") ||
		strings.HasPrefix(t, "nvarchar") ||
		strings.HasPrefix(t, "clob")
}
259055
func isPrimitive(mtype reflect.Type) bool {
	switch mtype.Kind() {
	case reflect.Ptr:
		return isPrimitive(mtype.Elem())
	case reflect.Bool:
		return true
	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
		return true
	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
		return true
	case reflect.Float32, reflect.Float64:
		return true
	case reflect.String:
		return true
	case reflect.Struct:
		return mtype == timeType || isCustomMarshaler(mtype)
	default:
		return false
	}
}
470679
func (s *StringRule) MarshalJSON() ([]byte, error) {
	return json.Marshal(&struct {
		Key      string             `json:"key"`
		Required bool               `json:"required"`
		Default  ctypes.ConfigValue `json:"default"`
		Type     string             `json:"type"`
	}{
		Key:      s.key,
		Required: s.required,
		Default:  s.Default(),
		Type:     StringType,
	})
}
692168
func IsArrayType(t string) bool {
	tip := raml.Type{
		Type: t,
	}
	return tip.IsArray()
}
786438
func (b *BoolRule) MarshalJSON() ([]byte, error) {
	return json.Marshal(&struct {
		Key      string             `json:"key"`
		Required bool               `json:"required"`
		Default  ctypes.ConfigValue `json:"default,omitempty"`
		Type     string             `json:"type"`
	}{
		Key:      b.key,
		Required: b.required,
		Default:  b.Default(),
		Type:     BoolType,
	})
}
1237665
func canMarshal(t reflect.Type) bool {
	// unless it implements marshalText or marshalCSV. Structs that implement this
	// should result in one value and not have their fields exposed
	_, canMarshalText := t.MethodByName("MarshalText")
	_, canMarshalCSV := t.MethodByName("MarshalCSV")
	return canMarshalCSV || canMarshalText
}
618368
func receiverType(val interface{}) string {
	t := reflect.TypeOf(val)
	if t.Name() != "" {
		return t.String()
	}
	return "(" + t.String() + ")"
}
1092923
func (t *Type) Covariant(ot *Type) bool {
	if !strings.HasPrefix(t.String(), ot.String()) {
		return false
	}
	// /type/foo is covariant of /type, but /typefoo is not covariant of /type.
	return len(t.String()) == len(ot.String()) || t.String()[len(ot.String())] == '/'
}