Documentation
¶
Index ¶
- func ParseEnum(v protoreflect.Enum) (string, error)
- func ParseOrderBy[T protoreflect.Enum, O Order[T]](orderBy []O, defaultOrderBy []relay.Order) ([]relay.Order, error)
- func ParseOrderField(field protoreflect.Enum) (string, error)
- func ParsePagination[T any](p *relayv1.Pagination, orderBy ...relay.Order) *relay.PaginateRequest[T]
- type Order
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.
Click to show internal directories.
Click to hide internal directories.