github.com/webmafia/fast@v0.10.0/string_buffer_val.go (about) 1 package fast 2 3 import "fmt" 4 5 func (b *StringBuffer) WriteVal(val any) { 6 switch v := val.(type) { 7 8 case StringEncoder: 9 b.WriteEnc(v) 10 11 case fmt.Stringer: 12 b.WriteString(v.String()) 13 14 case string: 15 b.WriteString(v) 16 17 case []byte: 18 b.Write(v) 19 20 case int: 21 b.WriteInt(v) 22 23 case int8: 24 b.WriteInt8(v) 25 26 case int16: 27 b.WriteInt16(v) 28 29 case int32: 30 b.WriteInt32(v) 31 32 case int64: 33 b.WriteInt64(v) 34 35 case uint: 36 b.WriteUint(v) 37 38 case uint8: 39 b.WriteUint8(v) 40 41 case uint16: 42 b.WriteUint16(v) 43 44 case uint32: 45 b.WriteUint32(v) 46 47 case uint64: 48 b.WriteUint64(v) 49 50 case float32: 51 b.WriteFloat32(v) 52 53 case float64: 54 b.WriteFloat64(v) 55 56 case bool: 57 b.WriteBool(v) 58 59 default: 60 b.WriteString("(any)") 61 62 } 63 }