helper

package
v0.0.0-...-908e76c Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorOr

func ErrorOr[T any](logger *zap.Logger, res *connect.Response[T], err error) (*connect.Response[T], error)

ErrorOr returns a grpc error if err is not nil. Otherwise, returns res. If err is app.ErrInvalidArgument, returns codes.InvalidArgument. If err is app.ErrNotFound, returns codes.NotFound. Otherwise, returns codes.Unknown.

func PageToken

func PageToken(p *v1.Pagination) (string, error)

PageToken returns a page token from the pagination object. If the pagination object is nil, it returns an empty string. It means that the last page is returned.

func Pagination

func Pagination(req listRequest) (*v1.Pagination, error)

Pagination returns a pagination object from the list request. If the page token is empty, it returns nil. It means that the first page is requested. If the page token is invalid, it returns app.ErrInvalidArgument.

Types

This section is empty.

Jump to

Keyboard shortcuts

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