Skip to content

itcomusic/protowrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
}