This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.0.0 | |
info: | |
title: Todo app OAS | |
description: OpenApi specification for a todo application | |
version: 1.0.0 | |
servers: | |
- url: http://localhost:32208/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Package main provides primitives to interact with the openapi HTTP API. | |
// | |
// Code generated by github.com/deepmap/oapi-codegen version v1.8.1 DO NOT EDIT. | |
package main | |
import ( | |
"time" | |
) | |
// Defines values for TodoStatus. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GetTodos operation middleware | |
func (siw *ServerInterfaceWrapper) GetTodos(w http.ResponseWriter, r *http.Request) { | |
ctx := r.Context() | |
var err error | |
// Parameter object where we will unmarshal all parameters from the context | |
var params GetTodosParams | |
// ------------- Required query parameter "user" ------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Handler creates http.Handler with routing matching OpenAPI spec. | |
func Handler(si ServerInterface) http.Handler { | |
return HandlerWithOptions(si, ChiServerOptions{}) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "net/http" | |
type TodoServer struct { | |
} | |
func (t TodoServer) GetTodos(w http.ResponseWriter, r *http.Request, params GetTodosParams) { | |
// our logic to retrieve all todos from a persistent layer | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ServerInterfaceWrapper converts contexts to parameters. | |
type ServerInterfaceWrapper struct { | |
Handler ServerInterface | |
HandlerMiddlewares []MiddlewareFunc | |
} | |
// HandlerWithOptions creates http.Handler with additional options | |
func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler { | |
r := options.BaseRouter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax = "proto3"; | |
package api; | |
enum TaskState { | |
TASK_OPEN = 0; | |
TASK_IN_PROGRESS = 1; | |
TASK_DONE = 2; | |
TASK_POST_PONED = 3; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package domain | |
import ( | |
"github.com/google/uuid" | |
) | |
type Pet struct { | |
ID uuid.UUID `json:"id" bson:"id,omitempty"` | |
Category string `json:"category" bson:"category,omitempty"` | |
Breed string `json:"breed" bson:"breed,omitempty"` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package app | |
import ( | |
"github.com/d-vignesh/getpets/pkg/domain" | |
"github.com/google/uuid" | |
) | |
// petSvc implements domain.PetSvc | |
type petSvc struct { | |
DB domain.PetDB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package db | |
import ( | |
"github.com/d-vignesh/getpets/pkg/domain" | |
"github.com/google/uuid" | |
"github.com/pkg/errors" | |
) | |
// inMemStore implements domain.PetDB with an memory storage | |
type inMemStore struct { |
OlderNewer