protorelay

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseEnum

func ParseEnum(v protoreflect.Enum) (string, error)

ParseEnum parses a proto enum to a string which is the value of the enum without the prefix. e.g., "PRODUCT_STATUS_DRAFT" -> "DRAFT"

func ParseOrderBy

func ParseOrderBy[T protoreflect.Enum, O Order[T]](orderBy []O, defaultOrderBy []relay.Order) ([]relay.Order, error)

ParseOrderBy parses proto order messages to OrderBy.

func ParseOrderField

func ParseOrderField(field protoreflect.Enum) (string, error)

ParseOrderField parses a proto order field to a string. e.g., "PRODUCT_ORDER_FIELD_CREATED_AT" -> "CreatedAt"

func ParsePagination

func ParsePagination[T any](p *relayv1.Pagination, orderBy ...relay.Order) *relay.PaginateRequest[T]

ParsePagination parses a proto pagination to a paginate request.

Types

type Order

type Order[T protoreflect.Enum] interface {
	GetField() T
	GetDirection() relayv1.OrderDirection
}

Order is an interface that all proto order messages must implement.

Directories

Path Synopsis
gen

Jump to

Keyboard shortcuts

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