domain

package
v0.0.0-...-2147667 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Name      string
	Generated bool
	Immutable bool
}

type Filter

type Filter struct {
	Field         string `json:"field"`
	Value         any    `json:"value"`
	Op            Op     `json:"op"`
	CaseSensitive bool   `json:"is_case_sensitive"`
}

type FilterValueType

type FilterValueType int
const (
	String FilterValueType
	Integer
	Float
	Boolean
	Date
	Time
	DateTime
)

type ListRequest

type ListRequest struct {
	Pagination Pagination
	Filters    []Filter
	Sorts      []Sort
}

type ListResponse

type ListResponse[T any] struct {
	Items []*T `json:"items"`
	Count int  `json:"count"`
}

type Op

type Op int
const (
	Eq Op
	Ne
	Gt
	Lt
	Ge
	Le
	In
	NotIn
	Contains
	NotContains
	StartsWith
	EndsWith
	Null
	NotNull
	Between
)

type Page

type Page struct {
	Next       int `json:"next"`
	Prev       int `json:"prev"`
	Total      int `json:"total"`
	TotalPages int `json:"total_pages"`
}

type Pagination

type Pagination struct {
	Offset int `json:"offset"`
	Limit  int `json:"limit"`
}

type Sort

type Sort struct {
	Field         string    `json:"field"`
	Order         SortOrder `json:"order"`
	CaseSensitive bool      `json:"case_sensitive"`
}

type SortOrder

type SortOrder string
const (
	Asc  SortOrder = "asc"
	Desc SortOrder = "desc"
)

type Table

type Table struct {
	Name       string
	Columns    []string
	Insertable []string
	Updatable  []string
}

func StructToTable

func StructToTable(target any, tableName string) (*Table, error)

Jump to

Keyboard shortcuts

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