Documentation
¶
Index ¶
- Constants
- type BackendRequest
- type CreateApi
- type CutData
- type CutResponse
- type DataBaseAdapter
- type DeleteApi
- type Field
- type FileApi
- type FrontendResponse
- type Icon
- type Input
- type Module
- type Object
- func (o *Object) AddModule(m *Module, api_name ...string)
- func (o Object) Api() string
- func (o *Object) BuildHtmlForm() string
- func (o *Object) BuildJSInputFormModule() string
- func (o Object) Columns() (columns []string)
- func (o Object) DataDecode(cut_data ...CutData) ([]map[string]string, error)
- func (o Object) DataEncode(all_data ...map[string]string) (out []CutData)
- func (o Object) FieldExist(field_name string) (Field, bool)
- func (o Object) FilterFields(namesRequired ...string) (fielsOut []Field)
- func (o Object) FilterRemoveFields(namesToRemove ...string) (fielsOut []Field)
- func (o Object) GetFieldByName(nameRq string) (fielOut Field)
- func (o Object) GetID(data_search map[string]string) string
- func (o Object) GetRepresentativeTextField(data_element map[string]string) (values string)
- func (o Object) MainName() string
- func (o Object) Module() *Module
- func (o Object) ModuleName() string
- func (o Object) PrimaryKeyName() string
- func (o Object) RenderFields() (fielsOut []Field)
- func (o Object) RequiredFields() (fielsOut []Field)
- func (o *Object) Response(action, message string, data ...map[string]string) Response
- func (o Object) ValidateData(its_new, its_update_or_delete bool, all_data ...map[string]string) error
- type Package
- type Page
- type Path
- type Permission
- type ReadApi
- type Request
- type Response
- type Tag
- type TestData
- type Theme
- type UI
- type UpdateApi
- type User
- type Validate
Constants ¶
View Source
const INPUT_PATTERN = `Input: input\.(\w+)\(\)`
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendRequest ¶ added in v0.0.33
type CutData ¶ added in v0.0.19
type CutData struct {
// ej Modelo Objeto: usuario := Object{Name: "Usuario",Fields: []Field{
// {Name: "name"}, //0
// {Name: "email"},//1
// {Name: "phone"},//2
// },}
// ej data normal con todos los campos: {"name":"John Doe","email":"johndoe@example.com","phone":"555"}
// version recortada Data: {"John Doe","johndoe@example.com","555"}
// Index Objeto al codificar = {"0:0","1:1","2:2"}
// ej no mail: {"marcel", "777"}
// Index al codificar = {"0:0","1:2"}
Index map[uint8]uint8 `json:"i"`
//Data ej en mapa: "Data":[{"id":"222","name":"manzana","valor":"1200"}]
// ahora: "Data":["222","manzana","1200"]
Data []string `json:"d"`
}
type CutResponse ¶ added in v0.0.19
type CutResponse struct {
//Action,Object,Module,Message
//ej: ["create","user","ModuleUsers","ok"]
CutOptions []string `json:"o"`
CutData []CutData `json:"d"`
}
func (*CutResponse) CutResponseDecode ¶ added in v0.0.21
func (cr *CutResponse) CutResponseDecode(data []map[string]string) (out Response)
type DataBaseAdapter ¶ added in v0.0.35
type DataBaseAdapter interface {
CreateObjectsInDB(table_name string, data ...map[string]string) error
ReadObjectsInDB(table_name string, data ...map[string]string) ([]map[string]string, error)
UpdateObjectsInDB(table_name string, data ...map[string]string) ([]map[string]string, error)
DeleteObjectsInDB(table_name string, data ...map[string]string) ([]map[string]string, error)
CreateTablesInDB(...*Object) error
}
type Field ¶
type Field struct {
// si el campo comienza com id_ se considera como único y perteneciente a una tabla específica ej: id_user su tabla es user
// otros ej: id_usuario, apellido, address, city etc
Name string
Legend string //como se mostrara al usuario el campo en el encabezado ej: "name" por "Nombre Usuario"
NotRenderHtml bool // si no se necesita en formulario html
Input
SkipCompletionAllowed bool //se permite que el campo no este completado. por defecto siempre sera requerido
Unique bool //campo único e inalterable en db
NotRequiredInDB bool // campo no requerido en base de datos al crear tabla
Encrypted bool // si estará encriptado su almacenamiento o no
}
func (Field) IsPrimaryKey ¶ added in v0.0.35
type FrontendResponse ¶ added in v0.0.33
type FrontendResponse struct {
}
type Module ¶
type Module struct {
Theme
//nombre modulo ej: chat,patient,user
ModuleName string
//Titulo que vera el usuario ej: "Modulo Fotografía"
Title string
// id icono para utilizar en sprite svg ej: icon-info
IconID string
//interfaz usuario modulo
UI
//areas soportadas por el modulo ej: 'a','t','x'
Areas []byte
// objetos o componentes que contiene el modulo ej: patient,user,datalist,search....
Objects []*Object
}
func (Module) BuildHtmlModule ¶ added in v0.0.29
func (Module) BuildMenuButton ¶ added in v0.0.29
func (Module) ContainsTypeAreas ¶ added in v0.0.30
type Object ¶
type Object struct {
// nombre del componente u objeto ej: client, search_footer,datalist,form
Name string
TextFieldNames []string //nombre de campos mas representativos del objeto o tabla ej: name, address, phone
Fields []Field //campos del objeto
BackendRequest
FrontendResponse
// contains filtered or unexported fields
}
func (*Object) BuildHtmlForm ¶ added in v0.0.31
func (*Object) BuildJSInputFormModule ¶ added in v0.0.31
func (Object) DataDecode ¶ added in v0.0.19
func (Object) DataEncode ¶ added in v0.0.19
DataEncode quita los nombres de los campos de la data según modelo del objeto
func (Object) FieldExist ¶ added in v0.0.16
func (Object) FilterFields ¶
func (Object) FilterRemoveFields ¶
func (Object) GetFieldByName ¶
func (Object) GetRepresentativeTextField ¶
func (Object) ModuleName ¶ added in v0.0.33
func (Object) PrimaryKeyName ¶
func (Object) RenderFields ¶
func (Object) RequiredFields ¶
type Package ¶ added in v0.0.35
type Package struct {
SkipMeInResponse bool `json:"-"` // saltarme al difundir
Recipients []string `json:"-"` // lista de ip, token o ids según app para el reenvió al finalizar solicitud
TargetArea bool `json:"-"` // si es falso el destino por defecto es publico de lo contrario sera para todos quines tengan la misma area del usuario solicitante
Response
}
type Page ¶ added in v0.0.33
type Page struct {
StyleSheet string // url ej style.css
AppName string
AppVersion string
SpriteIcons string
Menu string
UserName string
UserArea string
Message string
Modules string
Script string // ej main.js
}
index.html ej: {{.StyleSheet}} {{.AppName}} {{.AppVersion}} {{.SpriteIcons}} {{.Menu}} {{.Message}} {{.UserName}} {{.UserArea}} {{.Modules}} {{.Script}}
type Path ¶ added in v0.0.27
type Path interface {
FolderPath() string
}
FolderPath() string ej: func (Object) FolderPath() string { _, filename, _, _ := runtime.Caller(0) dir := filepath.Dir(filename) return filepath.ToSlash(dir) }
type Permission ¶
type Response ¶
type Response struct {
Action string `json:"a,omitempty"` //acción a realizar con la solicitud: create, read, update, delete o error
Object string `json:"o,omitempty"` //nombre de la tabla u objeto controlador hacia donde va la solicitud
Message string `json:"g,omitempty"` //mensaje para el usuario de la solicitud
Data []map[string]string `json:"d,omitempty"` //data entrada y respuesta json
}
type Theme ¶ added in v0.0.29
type Theme interface {
// ModuleHtmlTemplate ej: nombre del modulo html y el contenido
//<div id="` + module_name + `" class="slider_panel">` + content + `</div>
ModuleHtmlTemplate(module_name, content string) string
// MenuButtonTemplate ej: <li class="navbar-item"><a href="#` + module_name + `" tabindex="` + index + `" class="navbar-link" name="` + module_name + `">
// <svg aria-hidden="true" focusable="false" class="fa-primary"><use xlink:href="#` + icon_id + `" /></svg>
// <span class="link-text">` + title + `</span></a></li>
MenuButtonTemplate(module_name, index, icon_id, title string) string
FormTemplate(object_name, input_tags string) string
InputTemplate(object_name, field_name, legend, html_name, input_tag string, index int) string
InputIdTemplate(object_name, field_name, index string) string
JsFormVariablesTemplate(object_name string) string
JsInputVariableTemplate(field_name, html_name string) string
}
type User ¶
type User struct {
Token string // token de sesión solicitante
Ip string
Name string
Area byte //0 sin area.. un que byte y uint8 son lo mismo en go la idea que aca sea un valor de carácter ej: a,s,p...
AccessLevel uint8 // aquí valor numérico 0 a 255
Packages chan []Response
LastConnection time.Time
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.