mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-01 11:58:21 +00:00
009e067ed8
Add the scalar package to reduce dependencies on the v1 proto runtime package. It may very well be the case that these functions should be exposed in the public API of v2, but that is not a decision we need to make now. Change-Id: Ifbc6d15311ba5837909ac72af47c630a80a142ef Reviewed-on: https://go-review.googlesource.com/c/151402 Reviewed-by: Herbie Ong <herbie@google.com>
19 lines
760 B
Go
19 lines
760 B
Go
// 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.
|
|
|
|
// Package scalar provides wrappers for populating optional scalar fields.
|
|
package scalar
|
|
|
|
// TODO: Should this be public in the v2 API? Where should it live?
|
|
// Would we want to do something different if Go gets generics?
|
|
|
|
func Bool(v bool) *bool { return &v }
|
|
func Int32(v int32) *int32 { return &v }
|
|
func Int64(v int64) *int64 { return &v }
|
|
func Uint32(v uint32) *uint32 { return &v }
|
|
func Uint64(v uint64) *uint64 { return &v }
|
|
func Float32(v float32) *float32 { return &v }
|
|
func Float64(v float64) *float64 { return &v }
|
|
func String(v string) *string { return &v }
|