gotrix

package module
v0.0.0-...-3f88e16 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

README

gotrix

GOTRIX Core.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CatalogItemPropertyTable = &catalogItemPropertyTableType{
	s: parse.StructInfo{Type: "CatalogItemProperty", SQLSchema: "", SQLName: "catalog_item_properties", Fields: []parse.FieldInfo{{Name: "PropertyID", Type: "string", Column: "property_id"}, {Name: "ItemID", Type: "string", Column: "item_id"}, {Name: "CatalogID", Type: "string", Column: "catalog_id"}, {Name: "PropertyKey", Type: "string", Column: "property_key"}, {Name: "PropertyValue", Type: "string", Column: "property_value"}, {Name: "CreatedAt", Type: "time.Time", Column: "created_at"}, {Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"}}, PKFieldIndex: 0},
	z: new(CatalogItemProperty).Values(),
}

CatalogItemPropertyTable represents catalog_item_properties view or table in SQL database.

View Source
var CatalogItemTable = &catalogItemTableType{
	s: parse.StructInfo{Type: "CatalogItem", SQLSchema: "", SQLName: "catalog_items", Fields: []parse.FieldInfo{{Name: "ItemID", Type: "string", Column: "item_id"}, {Name: "CatalogID", Type: "string", Column: "catalog_id"}, {Name: "ItemName", Type: "string", Column: "item_name"}, {Name: "CreatedAt", Type: "time.Time", Column: "created_at"}, {Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"}}, PKFieldIndex: 0},
	z: new(CatalogItem).Values(),
}

CatalogItemTable represents catalog_items view or table in SQL database.

View Source
var CatalogTable = &catalogTableType{
	s: parse.StructInfo{Type: "Catalog", SQLSchema: "", SQLName: "catalogs", Fields: []parse.FieldInfo{{Name: "CatalogID", Type: "string", Column: "catalog_id"}, {Name: "CatalogName", Type: "string", Column: "catalog_name"}, {Name: "CreatedAt", Type: "time.Time", Column: "created_at"}, {Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"}}, PKFieldIndex: 0},
	z: new(Catalog).Values(),
}

CatalogTable represents catalogs view or table in SQL database.

Functions

func NewComponentParams

func NewComponentParams(name string, params []interface{}) *componentParams

Types

type App

type App interface {
	DB() *reform.DB
	Components() map[string]ComponentWrapper
}

App interface.

type AppConfig

type AppConfig struct {
	Port           int
	ComponentPaths []string
	TemplatePaths  []string
	StaticPaths    []string
}

AppConfig struct.

type Catalog

type Catalog struct {
	CatalogID   string    `json:"catalog_id" reform:"catalog_id,pk"`
	CatalogName string    `json:"catalog_name" reform:"catalog_name"`
	CreatedAt   time.Time `json:"created_at" reform:"created_at"`
	UpdatedAt   time.Time `json:"updated_at" reform:"updated_at"`
}

func (*Catalog) HasPK

func (s *Catalog) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*Catalog) PKPointer

func (s *Catalog) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*Catalog) PKValue

func (s *Catalog) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*Catalog) Pointers

func (s *Catalog) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*Catalog) SetPK

func (s *Catalog) SetPK(pk interface{})

SetPK sets record primary key.

func (Catalog) String

func (s Catalog) String() string

String returns a string representation of this struct or record.

func (*Catalog) Table

func (s *Catalog) Table() reform.Table

Table returns Table object for that record.

func (*Catalog) Values

func (s *Catalog) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*Catalog) View

func (s *Catalog) View() reform.View

View returns View object for that struct.

type CatalogItem

type CatalogItem struct {
	ItemID    string    `json:"item_id" reform:"item_id,pk"`
	CatalogID string    `json:"catalog_id" reform:"catalog_id"`
	ItemName  string    `json:"item_name" reform:"item_name"`
	CreatedAt time.Time `json:"created_at" reform:"created_at"`
	UpdatedAt time.Time `json:"updated_at" reform:"updated_at"`
}

func (*CatalogItem) HasPK

func (s *CatalogItem) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*CatalogItem) PKPointer

func (s *CatalogItem) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*CatalogItem) PKValue

func (s *CatalogItem) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*CatalogItem) Pointers

func (s *CatalogItem) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*CatalogItem) SetPK

func (s *CatalogItem) SetPK(pk interface{})

SetPK sets record primary key.

func (CatalogItem) String

func (s CatalogItem) String() string

String returns a string representation of this struct or record.

func (*CatalogItem) Table

func (s *CatalogItem) Table() reform.Table

Table returns Table object for that record.

func (*CatalogItem) Values

func (s *CatalogItem) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*CatalogItem) View

func (s *CatalogItem) View() reform.View

View returns View object for that struct.

type CatalogItemProperty

type CatalogItemProperty struct {
	PropertyID    string    `json:"property_id" reform:"property_id,pk"`
	ItemID        string    `json:"item_id" reform:"item_id"`
	CatalogID     string    `json:"catalog_id" reform:"catalog_id"`
	PropertyKey   string    `json:"property_key" reform:"property_key"`
	PropertyValue string    `json:"property_value" reform:"property_value"`
	CreatedAt     time.Time `json:"created_at" reform:"created_at"`
	UpdatedAt     time.Time `json:"updated_at" reform:"updated_at"`
}

func (*CatalogItemProperty) HasPK

func (s *CatalogItemProperty) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*CatalogItemProperty) PKPointer

func (s *CatalogItemProperty) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*CatalogItemProperty) PKValue

func (s *CatalogItemProperty) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*CatalogItemProperty) Pointers

func (s *CatalogItemProperty) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*CatalogItemProperty) SetPK

func (s *CatalogItemProperty) SetPK(pk interface{})

SetPK sets record primary key.

func (CatalogItemProperty) String

func (s CatalogItemProperty) String() string

String returns a string representation of this struct or record.

func (*CatalogItemProperty) Table

func (s *CatalogItemProperty) Table() reform.Table

Table returns Table object for that record.

func (*CatalogItemProperty) Values

func (s *CatalogItemProperty) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*CatalogItemProperty) View

func (s *CatalogItemProperty) View() reform.View

View returns View object for that struct.

type Component

type Component interface {
	Component(Context, ComponentParams) (map[string]interface{}, error)
}

Component interface. Must be implemented by all included components.

type ComponentParams

type ComponentParams interface {
	Name() string
	Params() []interface{}
}

type ComponentWrapper

type ComponentWrapper interface {
	Include(Context, ComponentParams) error
}

ComponentWrapper interface.

type Context

type Context interface {
	Writer() io.Writer
	Request() *http.Request
	AddAsyncCSS(...string)
	AddCSS(...string)
	AddAsyncJS(...string)
	AddDeferJS(...string)
	AddJS(...string)
	Component(string, ...interface{}) string
	SetData(string, interface{})
	Data(string) interface{}
}

Context interface.

type Page

type Page interface {
	Page(Context) error
	Template() *template.Template
}

type PageData

type PageData struct {
	// contains filtered or unexported fields
}

func NewPageData

func NewPageData(w io.Writer, r *http.Request, app App) *PageData

func (*PageData) AddAsyncCSS

func (pd *PageData) AddAsyncCSS(css ...string)

func (*PageData) AddAsyncJS

func (pd *PageData) AddAsyncJS(js ...string)

func (*PageData) AddCSS

func (pd *PageData) AddCSS(css ...string)

func (*PageData) AddDeferJS

func (pd *PageData) AddDeferJS(js ...string)

func (*PageData) AddJS

func (pd *PageData) AddJS(js ...string)

func (*PageData) AsyncCSS

func (pd *PageData) AsyncCSS() string

func (*PageData) Body

func (pd *PageData) Body() string

func (*PageData) CSS

func (pd *PageData) CSS() string

func (*PageData) Component

func (pd *PageData) Component(name string, params ...interface{}) string

func (*PageData) Data

func (pd *PageData) Data(k string) interface{}

func (*PageData) EndBody

func (pd *PageData) EndBody() string

func (*PageData) EndHead

func (pd *PageData) EndHead() string

func (*PageData) Error

func (pd *PageData) Error(format string, args ...interface{}) string

func (*PageData) Extend

func (pd *PageData) Extend() Context

func (*PageData) JS

func (pd *PageData) JS() string

func (*PageData) Request

func (pd *PageData) Request() *http.Request

func (*PageData) SetBody

func (pd *PageData) SetBody(body string)

func (*PageData) SetData

func (pd *PageData) SetData(k string, v interface{})

func (*PageData) SetSlug

func (pd *PageData) SetSlug(slug string)

func (*PageData) Slug

func (pd *PageData) Slug() string

func (*PageData) Writer

func (pd *PageData) Writer() io.Writer

type PathFlags

type PathFlags []string

func (*PathFlags) Set

func (i *PathFlags) Set(value string) error

func (*PathFlags) String

func (i *PathFlags) String() string

Directories

Path Synopsis
cli
mod
cmd

Jump to

Keyboard shortcuts

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