| // Copyright 2018 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| //go:build purego || appengine |
| // +build purego appengine |
| import "google.golang.org/protobuf/internal/pragma" |
| // value is a union where only one type can be represented at a time. |
| // This uses a distinct field for each type. This is type safe in Go, but |
| // occupies more memory than necessary (72B). |
| pragma.DoNotCompare // 0B |
| func valueOfString(v string) Value { |
| return Value{typ: stringType, str: v} |
| func valueOfBytes(v []byte) Value { |
| return Value{typ: bytesType, bin: v} |
| func valueOfIface(v any) Value { |
| return Value{typ: ifaceType, iface: v} |
| func (v Value) getString() string { |
| func (v Value) getBytes() []byte { |
| func (v Value) getIface() any { |