forms

package
v1.1.10008 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: GPL-3.0 Imports: 19 Imported by: 1

Documentation

Overview

генерация форм на основе типов полей таблиц БД

Index

Constants

View Source
const CELL_SELECT = `<td class="%s"><select name="%s:%s" class="">%s</select></td>`
View Source
const CELL_TABLE = `<td class="%s"><input type="%s" name="%s:%s" value="%s"/></td>`

Variables

This section is empty.

Functions

func AnotherSignUpForm

func AnotherSignUpForm(placeholder string) string

func GetLengthFromType

func GetLengthFromType(dataType string) (width int, size int)

минимальный размер поля для разных типов полей

func RenderCheckBox

func RenderCheckBox(key, val, title string, idx int, checked, required, events, dataJson string) string

func SignUpForm

func SignUpForm(placeholder string) string

func StreamAnotherSignUpForm

func StreamAnotherSignUpForm(qw422016 *qt422016.Writer, placeholder string)

func StreamRenderCheckBox

func StreamRenderCheckBox(qw422016 *qt422016.Writer, key, val, title string, idx int, checked, required, events, dataJson string)

func StreamSignUpForm

func StreamSignUpForm(qw422016 *qt422016.Writer, placeholder string)

func StyleInput

func StyleInput(dataType string) string

старый метод, обсолете, буду избавляться TODO старый метод, обсолете, буду избавляться

func WriteAnotherSignUpForm

func WriteAnotherSignUpForm(qq422016 qtio422016.Writer, placeholder string)

func WriteRenderCheckBox

func WriteRenderCheckBox(qq422016 qtio422016.Writer, key, val, title string, idx int, checked, required, events, dataJson string)

func WriteSignUpForm

func WriteSignUpForm(qq422016 qtio422016.Writer, placeholder string)

Types

type AnotherMarshalRow

type AnotherMarshalRow struct {
	Msg string
	N   int
}

type AnotherPersonData

type AnotherPersonData struct {
	Id    int
	Login string
	Email string
	Sex   int
	Rows  []MarshalRow
}

func (*AnotherPersonData) JSON

func (d *AnotherPersonData) JSON() string

func (*AnotherPersonData) StreamJSON

func (d *AnotherPersonData) StreamJSON(qw422016 *qt422016.Writer)

func (*AnotherPersonData) WriteJSON

func (d *AnotherPersonData) WriteJSON(qq422016 qtio422016.Writer)

type BlockColumns added in v1.0.330

type BlockColumns struct {
	Buttons            []Button
	Columns            []*ColumnDecor
	Id                 int
	Multiple           bool
	Title, Description string
}

type Button added in v1.0.337

type Button struct {
	Title      string
	Position   bool
	ButtonType string
}

type ColumnDecor added in v1.0.322

type ColumnDecor struct {
	dbEngine.Column
	IsHidden, IsReadOnly, IsSlice bool
	InputType                     string
	SelectOptions                 map[string]string
	PatternList                   dbEngine.Table
	PatternName                   string
	PlaceHolder                   string
	LinkNew                       string
	Label                         string

	Value interface{}
	// contains filtered or unexported fields
}

func NewColumnDecor added in v1.0.3393

func NewColumnDecor(column dbEngine.Column, patternList dbEngine.Table) *ColumnDecor

func (*ColumnDecor) Copy added in v1.0.11512

func (col *ColumnDecor) Copy() *ColumnDecor

func (*ColumnDecor) DataForJSON added in v1.0.3397

func (col *ColumnDecor) DataForJSON() string

func (*ColumnDecor) GetFields added in v1.0.3397

func (col *ColumnDecor) GetFields(columns []dbEngine.Column) []interface{}

func (*ColumnDecor) GetValues added in v1.0.322

func (col *ColumnDecor) GetValues() (values []interface{})

func (*ColumnDecor) InputName added in v1.0.322

func (col *ColumnDecor) InputName(i int) string

func (*ColumnDecor) InputTypeForJSON added in v1.0.3397

func (col *ColumnDecor) InputTypeForJSON() string

func (*ColumnDecor) Pattern added in v1.0.322

func (col *ColumnDecor) Pattern() string

func (*ColumnDecor) Placeholder added in v1.0.324

func (col *ColumnDecor) Placeholder() string

func (*ColumnDecor) RenderAttr added in v1.0.3397

func (col *ColumnDecor) RenderAttr(i int) string

func (*ColumnDecor) RenderInputs added in v1.0.322

func (col *ColumnDecor) RenderInputs() string

func (*ColumnDecor) StreamDataForJSON added in v1.0.3397

func (col *ColumnDecor) StreamDataForJSON(qw422016 *qt422016.Writer)

func (*ColumnDecor) StreamInputTypeForJSON added in v1.0.3397

func (col *ColumnDecor) StreamInputTypeForJSON(qw422016 *qt422016.Writer)

func (*ColumnDecor) StreamRenderAttr added in v1.0.3397

func (col *ColumnDecor) StreamRenderAttr(qw422016 *qt422016.Writer, i int)

func (*ColumnDecor) StreamRenderInputs added in v1.0.322

func (col *ColumnDecor) StreamRenderInputs(qw422016 *qt422016.Writer)

func (*ColumnDecor) Type added in v1.0.322

func (col *ColumnDecor) Type() string

func (*ColumnDecor) WriteDataForJSON added in v1.0.3397

func (col *ColumnDecor) WriteDataForJSON(qq422016 qtio422016.Writer)

func (*ColumnDecor) WriteInputTypeForJSON added in v1.0.3397

func (col *ColumnDecor) WriteInputTypeForJSON(qq422016 qtio422016.Writer)

func (*ColumnDecor) WriteRenderAttr added in v1.0.3397

func (col *ColumnDecor) WriteRenderAttr(qq422016 qtio422016.Writer, i int)

func (*ColumnDecor) WriteRenderInputs added in v1.0.322

func (col *ColumnDecor) WriteRenderInputs(qq422016 qtio422016.Writer)

type FieldStructure

type FieldStructure struct {
	Table                    *FieldsTable
	COLUMN_NAME              string
	DATA_TYPE                string
	COLUMN_DEFAULT           string
	IS_NULLABLE              string
	CHARACTER_SET_NAME       string
	COLUMN_COMMENT           string
	COLUMN_TYPE              string
	CHARACTER_MAXIMUM_LENGTH int
	Value                    string
	IsHidden                 bool
	InputType                string
	CSSClass                 string
	CSSStyle                 string
	TableName                string
	Events                   map[string]string
	Where                    string
	Figure                   string
	Placeholder              string
	Pattern                  string
	MinDate                  string
	MaxDate                  string
	BeforeHtml               string
	Html                     string
	AfterHtml                string
	ForeignFields            string
	LinkTD                   string
	DataJSOM                 map[string]interface{}
	EnumValues               []string
}

Сия структура нужна для подготовки к отображению поля на форме (возможо, в таблице и еще других компонентах веб-старницы) На данный момент создается на лету, в будущем TODO: перенести в сервис отдачи структур и сделать независемым от реализации СУБД

func (*FieldStructure) GetColumnTitles

func (fieldStrc *FieldStructure) GetColumnTitles() (titleFull, titleLabel, placeholder, pattern, dataJson string)

func (*FieldStructure) GetListJSON

func (field *FieldStructure) GetListJSON(key, val, required, events, dataJson string)

func (*FieldStructure) GetOptions

func (field *FieldStructure) GetOptions(tableName, val string)

func (*FieldStructure) GetOptionsJson

func (field *FieldStructure) GetOptionsJson(tableName string)

func (*FieldStructure) GetTitle

func (fieldStrc *FieldStructure) GetTitle(field db.FieldStructure) string

func (*FieldStructure) RenderDateAttributtes

func (fieldStrc *FieldStructure) RenderDateAttributtes() string

func (*FieldStructure) RenderEnum

func (field *FieldStructure) RenderEnum(key, val, required, events, dataJson string) (result string)

func (*FieldStructure) RenderForeignSelect

func (field *FieldStructure) RenderForeignSelect(tablePrefix, key, val, titleLabel, required, events, dataJson string) string

func (*FieldStructure) RenderInputFromType

func (fieldStrc *FieldStructure) RenderInputFromType(nameInput, val, title, placeholder, pattern, required, events, dataJson string) string

func (*FieldStructure) RenderMultiSelect

func (field *FieldStructure) RenderMultiSelect(ns *FieldsTable, tablePrefix, key, val, titleLabel, required string) string

func (*FieldStructure) RenderParentSelect

func (field *FieldStructure) RenderParentSelect(nameTable, key, val, titleLabel, required, events, dataJson string) string

func (*FieldStructure) RenderSet

func (field *FieldStructure) RenderSet(key, val, required, events, dataJson string) (result string)

func (*FieldStructure) RenderTable

func (field *FieldStructure) RenderTable(ns *FieldsTable, tablePrefix, key, val, titleLabel, required string) string

func (*FieldStructure) Scan

func (field *FieldStructure) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*FieldStructure) StreamRenderDateAttributtes

func (fieldStrc *FieldStructure) StreamRenderDateAttributtes(qw422016 *qt422016.Writer)

func (*FieldStructure) StreamRenderForeignSelect

func (field *FieldStructure) StreamRenderForeignSelect(qw422016 *qt422016.Writer, tablePrefix, key, val, titleLabel, required, events, dataJson string)

func (*FieldStructure) StreamRenderInputFromType

func (fieldStrc *FieldStructure) StreamRenderInputFromType(qw422016 *qt422016.Writer, nameInput, val, title, placeholder, pattern, required, events, dataJson string)

func (*FieldStructure) StreamRenderMultiSelect

func (field *FieldStructure) StreamRenderMultiSelect(qw422016 *qt422016.Writer, ns *FieldsTable, tablePrefix, key, val, titleLabel, required string)

func (*FieldStructure) StreamRenderParentSelect

func (field *FieldStructure) StreamRenderParentSelect(qw422016 *qt422016.Writer, nameTable, key, val, titleLabel, required, events, dataJson string)

func (*FieldStructure) StreamRenderTable

func (field *FieldStructure) StreamRenderTable(qw422016 *qt422016.Writer, ns *FieldsTable, tablePrefix, key, val, titleLabel, required string)

func (*FieldStructure) TypeInput

func (field *FieldStructure) TypeInput() string

стиль показа для разных типов полей новый метод, еще обдумываю

func (*FieldStructure) WriteRenderDateAttributtes

func (fieldStrc *FieldStructure) WriteRenderDateAttributtes(qq422016 qtio422016.Writer)

func (*FieldStructure) WriteRenderForeignSelect

func (field *FieldStructure) WriteRenderForeignSelect(qq422016 qtio422016.Writer, tablePrefix, key, val, titleLabel, required, events, dataJson string)

func (*FieldStructure) WriteRenderInputFromType

func (fieldStrc *FieldStructure) WriteRenderInputFromType(qq422016 qtio422016.Writer, nameInput, val, title, placeholder, pattern, required, events, dataJson string)

func (*FieldStructure) WriteRenderMultiSelect

func (field *FieldStructure) WriteRenderMultiSelect(qq422016 qtio422016.Writer, ns *FieldsTable, tablePrefix, key, val, titleLabel, required string)

func (*FieldStructure) WriteRenderParentSelect

func (field *FieldStructure) WriteRenderParentSelect(qq422016 qtio422016.Writer, nameTable, key, val, titleLabel, required, events, dataJson string)

func (*FieldStructure) WriteRenderTable

func (field *FieldStructure) WriteRenderTable(qq422016 qtio422016.Writer, ns *FieldsTable, tablePrefix, key, val, titleLabel, required string)

type FieldsTable

type FieldsTable struct {
	Name           string
	ID             int
	Comment        string
	IsDadata       bool
	Rows           []FieldStructure
	Hiddens        map[string]string
	SaveFormEvents map[string]string
	DataJSOM       map[string]interface{}
}

func (*FieldsTable) AppendNewFieldRows

func (fields *FieldsTable) AppendNewFieldRows(fields1 FieldsTable, args ...interface{})

AppendNewFieldRows - Добаляет в fields поля из других таблиц @version 1.00 2017-05-13 @author Serg Litvinov

func (*FieldsTable) FindField

func (ns *FieldsTable) FindField(name string) *FieldStructure

func (*FieldsTable) PutDataFrom

func (fields *FieldsTable) PutDataFrom(ns db.FieldsTable)

заполняет структуру для формы данными, взятыми из структуры БД

func (*FieldsTable) ShowAnyForm

func (ns *FieldsTable) ShowAnyForm(Action, Title string) string

func (*FieldsTable) ShowRecord

func (fields *FieldsTable) ShowRecord(id string) string

func (*FieldsTable) StreamShowAnyForm

func (ns *FieldsTable) StreamShowAnyForm(qw422016 *qt422016.Writer, Action, Title string)

func (*FieldsTable) StreamShowRecord

func (fields *FieldsTable) StreamShowRecord(qw422016 *qt422016.Writer, id string)

func (*FieldsTable) WriteShowAnyForm

func (ns *FieldsTable) WriteShowAnyForm(qq422016 qtio422016.Writer, Action, Title string)

func (*FieldsTable) WriteShowRecord

func (fields *FieldsTable) WriteShowRecord(qq422016 qtio422016.Writer, id string)

type FormField added in v1.0.330

type FormField struct {
	Title, Action, Method, Description string
}

func (*FormField) FormHTML added in v1.0.331

func (f *FormField) FormHTML(blocks ...BlockColumns) string

func (*FormField) FormJSON added in v1.0.330

func (f *FormField) FormJSON(blocks ...BlockColumns) string

func (*FormField) RenderForm added in v1.0.11512

func (f *FormField) RenderForm(isHTML bool, blocks ...BlockColumns) string

func (*FormField) StreamFormHTML added in v1.0.331

func (f *FormField) StreamFormHTML(qw422016 *qt422016.Writer, blocks ...BlockColumns)

func (*FormField) StreamFormJSON added in v1.0.330

func (f *FormField) StreamFormJSON(qw422016 *qt422016.Writer, blocks ...BlockColumns)

func (*FormField) StreamRenderForm added in v1.0.11512

func (f *FormField) StreamRenderForm(qw422016 *qt422016.Writer, isHTML bool, blocks ...BlockColumns)

func (*FormField) WriteFormHTML added in v1.0.331

func (f *FormField) WriteFormHTML(qq422016 qtio422016.Writer, blocks ...BlockColumns)

func (*FormField) WriteFormJSON added in v1.0.330

func (f *FormField) WriteFormJSON(qq422016 qtio422016.Writer, blocks ...BlockColumns)

func (*FormField) WriteRenderForm added in v1.0.11512

func (f *FormField) WriteRenderForm(qq422016 qtio422016.Writer, isHTML bool, blocks ...BlockColumns)

type MarshalRow

type MarshalRow struct {
	Msg string
	N   int
}

type PersonData

type PersonData struct {
	Id    int
	Login string
	Email string
	Sex   int
	Rows  []MarshalRow
}

func (*PersonData) JSON

func (d *PersonData) JSON() string

func (*PersonData) StreamJSON

func (d *PersonData) StreamJSON(qw422016 *qt422016.Writer)

func (*PersonData) WriteJSON

func (d *PersonData) WriteJSON(qq422016 qtio422016.Writer)

type SignForm

type SignForm struct {
	Email, Password string
}

func (*SignForm) SigninForm

func (sf *SignForm) SigninForm() string

func (*SignForm) StreamSigninForm

func (sf *SignForm) StreamSigninForm(qw422016 *qt422016.Writer)

func (*SignForm) WriteSigninForm

func (sf *SignForm) WriteSigninForm(qq422016 qtio422016.Writer)

Jump to

Keyboard shortcuts

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