api

package
v0.0.0-...-90a23b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CookieName = "goapi-Cookie"
)

Variables

View Source
var (
	ErrExpiredSession error
)

Functions

This section is empty.

Types

type Account

type Account struct {
	ID                         uuid.UUID `json:"ID"`
	FirstName, LastName, Email string
	Gender                     string
}

AccountView is the restricted response body of Account see: https://stackoverflow.com/questions/46427723/golang-elegant-way-to-omit-a-json-property-from-being-serialized

func ToAPIAccount

func ToAPIAccount(internalAccount *goapi.Account, options map[string]bool) Account

ToAPIAccount returns the Account struct restricted to those fields allowed in options see: https://stackoverflow.com/questions/46427723/golang-elegant-way-to-omit-a-json-property-from-being-serialized

func Views

func Views(accs goapi.Accounts, options map[string]bool) []Account

type CreateAccountRequest

type CreateAccountRequest struct {
	FirstName string
	LastName  string
	Email     string
}

func (*CreateAccountRequest) Validate

func (c *CreateAccountRequest) Validate() error

type Handler

type Handler struct {
	*zap.SugaredLogger
	Accounts      pb.AccountsClient
	Router        *gin.Engine
	LogRawRequest bool
	// contains filtered or unexported fields
}

func New

func New(ac pb.AccountsClient, logger *zap.SugaredLogger, logRawRequest bool) (*Handler, error)

func (*Handler) AuthMiddleware

func (h *Handler) AuthMiddleware(c *gin.Context)

func (*Handler) InitializeRoutes

func (h *Handler) InitializeRoutes()

func (*Handler) Unmarshal

func (h *Handler) Unmarshal(c *gin.Context, iface interface{}) error

func (*Handler) WrappedLogger

func (h *Handler) WrappedLogger(ctx context.Context) *zap.SugaredLogger

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL