models

package
v0.0.0-...-ddbfd60 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const HUMAN = "Monday, January 2, 2006 3:04 PM"
View Source
const ISO8601 = "2006-01-02T15:04:05-07:00"

Variables

This section is empty.

Functions

func MakeSlug

func MakeSlug(s string) string

func RemoveMostNonAlphanumeric

func RemoveMostNonAlphanumeric(s string) string

func RemoveNonAlphanumeric

func RemoveNonAlphanumeric(s string) string

func TypeToFlavor

func TypeToFlavor(dt, udt, cd string) string

Types

type Field

type Field struct {
	Name      string   `json:"name"`
	Flavor    string   `json:"flavor"`
	Index     string   `json:"index"`
	Required  string   `json:"required"`
	Regex     string   `json:"regex"`
	Default   string   `json:"default"`
	Null      string   `json:"null"`
	JsonNames []string `json:"json_names"`
	JsonTypes []string `json:"json_types"`
}

func FindField

func FindField(model *Model, id string) *Field

func (*Field) CommonExclude

func (f *Field) CommonExclude() bool

func (*Field) RandomValue

func (f *Field) RandomValue() any

func (*Field) SaneDefault

func (f *Field) SaneDefault() any

func (*Field) SqlTypeAndDefault

func (f *Field) SqlTypeAndDefault() (string, string)

type Model

type Model struct {
	Name   string   `json:"name"`
	Fields []*Field `json:"fields"`
}

func (*Model) CurlListResponse

func (m *Model) CurlListResponse() string

func (*Model) CurlPostPayload

func (m *Model) CurlPostPayload() string

func (*Model) CurlPutPayload

func (m *Model) CurlPutPayload() string

func (*Model) CurlResponse

func (m *Model) CurlResponse() any

func (*Model) CurlSingleResponse

func (m *Model) CurlSingleResponse() string

func (*Model) CurlSingleResponseNoWrapper

func (m *Model) CurlSingleResponseNoWrapper() string

func (*Model) EnsureIdAndCreatedAt

func (m *Model) EnsureIdAndCreatedAt()

func (*Model) ExampleAlFields

func (m *Model) ExampleAlFields() map[string]any

func (*Model) TableName

func (m *Model) TableName() string

type Path

type Path struct {
	Verb     string `json:"verb"`
	Second   string `json:"second"`
	Third    string `json:"third"`
	Params   string `json:"params"`
	Response string `json:"response"`
}

type Route

type Route struct {
	Root  string  `json:"root"`
	Paths []*Path `json:"paths"`
}

func (*Route) Generate

func (r *Route) Generate(root string) string

Jump to

Keyboard shortcuts

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