Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/googleapis/go-type-adapters

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/googleapis/go-type-adapters

  • v1.0.1
  • Source
  • Go
  • Socket score

Version published
Created
Source

Go google.type Adapters

ci latest release go version

This library provides helper functions for converting between the Go proto messages in google.type (as found in genproto) and Go native types.

Full docs are at https://pkg.go.dev/github.com/googleapis/go-type-adapters.

Example

As a simple example, this library can convert between a google.type.Decimal (proto definition, Go docs) and a Go big.Float:

import (
  "github.com/googleapis/go-type-adapters/adapters"
  dpb "google.golang.org/genproto/type/decimal"
)

func main() {
  decimal := &dpb.Decimal{Value: "12345.678"}
  flt, err := adapters.DecimalToFloat(decimal)
  if err != nil {
    panic(err)
  }
  // flt is a Go *big.Float and can be used as such...
}

License

This software is made available under the Apache 2.0 license.

FAQs

Package last updated on 14 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc