Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 954 Bytes

README.md

File metadata and controls

41 lines (30 loc) · 954 Bytes

Protobuf wrapperspb helpers

pkg-img coverage-img

Provides helpers functions converting wrapperspb

Installation

Go version 1.18+

go get github.com/itcomusic/protowrap

Usage

package main

import (
	"fmt"

	"google.golang.org/protobuf/types/known/wrapperspb"

	"github.com/itcomusic/protowrap"
)

func main() {
	i := protowrap.IntF32V[int](&wrapperspb.Int32Value{Value: 1})
	fmt.Println(*i) // 1

	ints := protowrap.Ints[int]([]int32{1, 2, 3})
	fmt.Println(ints) // [1, 2, 3]

	wi32 := protowrap.Int32Value(i)
	fmt.Println(wi32) // value:1
}