• Stars
    star
    165
  • Rank 228,906 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Go SDK for implementing resource-oriented gRPC APIs.

Go Reference

AIP Go

Go SDK for implementing Google API Improvement Proposals (AIP).

Documentation

See https://aip.dev for the full AIP documentation.

Installing

$ go get -u go.einride.tech/aip

Examples

AIP-132 (Standard method: List)

  • Use pagination.PageToken to implement offset-based pagination.

    package examplelibrary
    
    import (
    	"context"
    
    	"go.einride.tech/aip/pagination"
    	"google.golang.org/genproto/googleapis/example/library/v1"
    	"google.golang.org/grpc/codes"
    	"google.golang.org/grpc/status"
    )
    
    func (s *Server) ListShelves(
    	ctx context.Context,
    	request *library.ListShelvesRequest,
    ) (*library.ListShelvesResponse, error) {
    	// Handle request constraints.
    	const (
    		maxPageSize     = 1000
    		defaultPageSize = 100
    	)
    	switch {
    	case request.PageSize < 0:
    		return nil, status.Errorf(codes.InvalidArgument, "page size is negative")
    	case request.PageSize == 0:
    		request.PageSize = defaultPageSize
    	case request.PageSize > maxPageSize:
    		request.PageSize = maxPageSize
    	}
    	// Use pagination.PageToken for offset-based page tokens.
    	pageToken, err := pagination.ParsePageToken(request)
    	if err != nil {
    		return nil, status.Errorf(codes.InvalidArgument, "invalid page token")
    	}
    	// Query the storage.
    	result, err := s.Storage.ListShelves(ctx, &ListShelvesQuery{
    		Offset:   pageToken.Offset,
    		PageSize: request.GetPageSize(),
    	})
    	if err != nil {
    		return nil, err
    	}
    	// Build the response.
    	response := &library.ListShelvesResponse{
    		Shelves: result.Shelves,
    	}
    	// Set the next page token.
    	if result.HasNextPage {
    		response.NextPageToken = pageToken.Next(request).String()
    	}
    	// Respond.
    	return response, nil
    }

More Repositories

1

can-go

Controller Area Network (CAN) SDK for Go.
Go
190
star
2

pid-go

PID controllers for Go.
Go
83
star
3

backstage-go

Backstage SDK for Go
Go
56
star
4

protobuf-bigquery-go

Seamlessly save and load protocol buffers to and from BigQuery using Go.
Go
49
star
5

cloudrunner-go

β˜οΈπŸƒ Get up and running with Go on Google Cloud.
Go
45
star
6

protoc-gen-typescript-http

Generate types and service clients from protobuf definitions annotated with http rules.
Go
44
star
7

sage

🌿 A Make-like build tool for Go projects
Go
37
star
8

gh-dependabot

GitHub CLI extension for reviewing Dependabot PRs.
Go
33
star
9

protobuf-avro-go

Converts protocol buffers to Avro.
Go
30
star
10

iam-go

An opinionated Open Source implementation of the google.iam APIs on top of Cloud Spanner.
Go
28
star
11

ui

Reusable React components that adhere to Einride's design system.
TypeScript
24
star
12

aip-cli-go

Generate command line interfaces to your gRPC services.
Go
24
star
13

supervisor-go

A service that starts and supervises other services and restarts them in case of failure.
Go
21
star
14

balena-go

The unofficial SDK to make balena powered Go applications.
Go
12
star
15

monta-go

Go SDK for accessing the Monta Partner API
Go
9
star
16

protoc-gen-go-aip-test

Go
8
star
17

spanner-aip-go

Go SDK for implementing Spanner persistance for resource-oriented APIs.
Go
8
star
18

protoc-gen-typescript-aip

Generates Typescript for gRPC APIs conforming to AIP https://aip.dev
Go
8
star
19

grpc-service-config-go

gRPC service config without service discovery.
Go
6
star
20

protobuf-sensitive

A sensitive annotation for redacting sensitive information from protocol buffers
Go
6
star
21

lcm-go

Native Go SDK for LCM (Lightweight Communications and Marshaling)
Go
6
star
22

vlp16-go

Go SDK for Velodyne VLP-16 LiDAR sensors.
Go
6
star
23

unit-go

Go SDK for modeling physical units and conversion between them
Go
5
star
24

here-go

Go SDK for the HERE Maps API.
Go
5
star
25

protocrate-rs

Generate Rust crate for protobuf schemas and gRPC APIs.
Rust
5
star
26

xsens-go

Go SDK for Xsens MTi Inertial Measurement Units (IMUs).
Go
4
star
27

clock-go

Go SDK with interfaces for clocks and time keeping
Go
3
star
28

protoc-gen-go-aip-dataloader

Generate GraphQL Go dataloaders for AIP BatchGet gRPC methods.
Go
3
star
29

nobil-go

Go SDK for the NOBIL.no public charger API.
Go
3
star
30

extend

Open APIs and developer tools for Einride's Saga platform.
Go
3
star
31

dataloader-go

Generic dataloaders for Go
Go
3
star
32

hooks

Reusable React hooks
TypeScript
2
star
33

terraform-provider-iam-go

A Terraform Provider for https://github.com/einride/iam-go
Go
2
star
34

ghcomment

A simple CLI tool for commenting on GitHub PRs
Go
1
star
35

csp-evaluator-cli

A command line tool to validate Content-Security-Policy rules
JavaScript
1
star
36

yamlfmt

A tool to format yaml files
Go
1
star
37

bigquery-importer-github

Data export from GitHub to BigQuery
Go
1
star
38

bigquery-importer-slack

Go service for importing Slack workspace data into BigQuery
Go
1
star
39

protoc-gen-messageintegrity

Code for the thesis "Implicit Message Integrity in Heterogeneous Systems".
Go
1
star
40

goreview

Einride-specific Go static analysis rules.
Go
1
star
41

tsconfig

Einride's default TSconfig
JavaScript
1
star
42

prettier-config

Einride's default Prettier config
JavaScript
1
star
43

protobuf-decap-cms

Manage protobuf resources using Decap CMS.
Go
1
star
44

aplicom-go

Go SDK for Aplicom telematics devices.
Go
1
star
45

spanner-backup-service

Go service for implementing scheduled backup for Cloud Spanner databases.
Go
1
star
46

google-cloud-proto-scrubber

Scrub unsupported annotations from Google Cloud gRPC API descriptors.
Go
1
star