github.com/vcilabs/webrpc@v0.5.2-0.20201116131534-162e27b1b33b/schema/golang/_example/example.go (about)

     1  package contract
     2  
     3  import (
     4  	"context"
     5  	"regexp"
     6  )
     7  
     8  type Author struct {
     9  	ID       int64
    10  	Name     string
    11  	Metadata map[string]string
    12  }
    13  
    14  type BookID int64
    15  
    16  type Book struct {
    17  	ID      BookID
    18  	Name    string
    19  	Authors []Author
    20  }
    21  
    22  type Library interface {
    23  	GetBooks(ctx context.Context) ([]Book, string, error)
    24  	BorrowBook(ctx context.Context, BookID int64) error
    25  	GetBookAuthor(ctx context.Context, BookID int64) (Author, map[string]string, regexp.Regexp, error)
    26  }