forms

package
v1.0.300 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2020 License: GPL-3.0 Imports: 13 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 ConvertType added in v1.0.297

func ConvertType(t string) string

func FormJSON added in v1.0.297

func FormJSON(title, action, method string, columns []dbEngine.Column) 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 StreamConvertType added in v1.0.297

func StreamConvertType(qw422016 *qt422016.Writer, t string)

func StreamFormJSON added in v1.0.297

func StreamFormJSON(qw422016 *qt422016.Writer, title, action, method string, columns []dbEngine.Column)

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 WriteConvertType added in v1.0.297

func WriteConvertType(qq422016 qtio422016.Writer, t string)

func WriteFormJSON added in v1.0.297

func WriteFormJSON(qq422016 qtio422016.Writer, title, action, method string, columns []dbEngine.Column)

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 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 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