github.com/vcilabs/webrpc@v0.5.2-0.20201116131534-162e27b1b33b/_examples/hello-webrpc-with-goschema-ts/contract.go (about)

     1  package contract
     2  
     3  //go:generate webrpc-gen -schema=contract.go -target=go -pkg=main -server -out=./server/hello_api.gen.go
     4  //go:generate webrpc-gen -schema=contract.go -target=ts -client -out=./webapp/src/client.gen.ts
     5  
     6  import (
     7  	"context"
     8  )
     9  
    10  type Kind uint32
    11  
    12  type Empty struct {
    13  }
    14  
    15  type User struct {
    16  	id         uint64
    17  	username   string
    18  	role       *Kind
    19  	meta       map[string]interface{}
    20  	internalID uint64
    21  }
    22  
    23  type Page struct {
    24  	num uint32
    25  }
    26  
    27  type ExampleService interface {
    28  	Ping(ctx context.Context) (bool, error)
    29  	GetUser(ctx context.Context, userID uint64) (*User, error)
    30  	FindUsers(ctx context.Context, q string) (*Page, []*User, error)
    31  }