Documentation
¶
Index ¶
- Constants
- func Error(messages ...any) *err
- type AfterClicked
- type AfterCreate
- type AfterDelete
- type AfterRead
- type AfterUpdate
- type AppInfo
- type AuthAdapter
- type BackendHandler
- type BootActions
- type BootResponse
- type ContainerView
- type CreateApi
- type CutData
- type CutResponse
- type DataBaseAdapter
- type DeleteApi
- type DomAdapter
- type Field
- type FileAdapter
- type FileApi
- type FileConfig
- type FileHandler
- type FileNewToStore
- type Form
- type FormAdapter
- type FrontendBootActions
- type FrontendHandler
- type Handlers
- type HttpAdapter
- type Icon
- type IdHandler
- type Input
- type InputReset
- type ItemView
- type Logger
- type Module
- type NotifyBootData
- type Object
- 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) FieldsToFormValidate() (fiels_out []Field)
- func (o Object) FilterRemoveFields(namesToRemove ...string) (fiels_out []Field)
- func (o Object) GetFieldsByNames(required_names ...string) ([]Field, error)
- func (o Object) GetID(data_search map[string]string) string
- func (o Object) GetRepresentativeTextField(data_element map[string]string) (values string)
- func (o Object) GetTablesNames() (out []string)
- func (o Object) JoinFieldNames(add_prefix_table_name bool) (out string)
- func (o Object) MainName() string
- func (o Object) OnlyRequiredDbFieldsThisObject() (db_field []Field)
- func (o Object) PrimaryKeyName(options ...string) string
- func (o Object) RenderFields() (fiels_out []Field)
- func (o Object) RequiredFields() (fiels_out []Field)
- func (o Object) Response(data []map[string]string, options ...string) Response
- func (o Object) TestData(required_objects int, skip_id, wrong_data bool) ([]map[string]string, error)
- func (o Object) ValidateData(its_new, its_update_or_delete bool, all_data ...map[string]string) error
- func (o Object) Where(data map[string]string) (out string)
- type ObjectAdapter
- type Package
- type Page
- type Path
- type Permission
- type PrinterHandler
- type ReadApi
- type ReadDBParams
- type Request
- type Response
- type SourceData
- type Subsequently
- type Tag
- type TestData
- type ThemeAdapter
- type TimeAdapter
- type TimeNow
- type TimeWeek
- type UI
- type UnixTimeHandler
- type UpdateApi
- type User
- type UserAuthNumber
- type UserMessage
- type Validate
- type ViewHandler
- type ViewReset
Constants ¶
const INPUT_PATTERN = `input\.(\w+)\([^)]*\)`
const PREFIX_ID_NAME = "id_"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AfterClicked ¶ added in v0.0.52
type AfterCreate ¶ added in v0.0.46
type AfterDelete ¶ added in v0.0.46
type AfterUpdate ¶ added in v0.0.46
type AuthAdapter ¶ added in v0.0.58
type AuthAdapter interface { UserAuthNumber }
type BackendHandler ¶ added in v0.0.46
type BackendHandler struct { BootResponse CreateApi ReadApi UpdateApi DeleteApi FileHandler }
type BootActions ¶ added in v0.0.44
type BootActions struct {
JsonBootActions string
}
type BootResponse ¶ added in v0.0.45
type ContainerView ¶ added in v0.0.64
type ContainerView interface {
BuildContainerView(id, field_name string, allow_skip_completed bool) string
}
todo el contenido html por defecto del objeto
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[int8]int8 `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 { IdHandler RunOnClientDB() bool //verdadero corren en el cliente ej browser. por defecto falso corre en el servidor // items support in server db: []map[string]string, map[string]string CreateObjectsInDB(table_name string, backup_required bool, items any) error // from_tables ej: "users,products" or: public.reservation, public.patient" // params: map[string]string ej:{ // LIMIT: 10, 5, 100. note: Postgres y MySQL: "LIMIT 10", SQLite: "LIMIT 10 OFFSET 0" OR "" no limit // ORDER_BY: name,phone,address // SELECT: "name, phone, address" default * // WHERE: "patient.id_patient = reservation.id_patient AND reservation.id_staff = '2'" // ARGS: "1,4,33" // } ReadObjectsInDB(from_tables string, params ...map[string]string) ([]map[string]string, error) //params: callback fun ej: fun([]map[string]string,error) // "ORDER_BY": "patient_name", "SORT":"DESC" DEFAULT "ASC" ReadStringDataAsyncInDB(r ReadDBParams, callback func([]map[string]string, error)) ReadAnyDataAsyncInDB(r ReadDBParams, callback func([]map[string]interface{}, error)) UpdateObjectsInDB(table_name string, data ...map[string]string) error DeleteObjectsInDB(table_name string, data ...map[string]string) error CreateTablesInDB(objects []*Object, action Subsequently) error BackupDataBase(callback func(error)) }
type DomAdapter ¶ added in v0.0.47
type DomAdapter interface { UserMessage InnerHTML(html_content string, o *Object) InsertAfterBegin(html_content string, o *Object) InsertBeforeEnd(html_content string, o *Object) Clicking(o *Object, id string) error ClickModule(module_name string) error CallFunction(functionName string, args ...any) error Form }
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" SourceTable string // tabla origen ej: patient,user,product 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 FileAdapter ¶ added in v0.0.64
type FileConfig ¶ added in v0.0.57
type FileConfig struct { MaximumFilesAllowed int64 // numero máximo de archivos permitidos ej: 4,100 etc InputNameWithFiles string // nombre del campo con los archivos multipart del formulario ej: files MaximumFileSize int64 // tamaño máximo de todos los archivos MaximumKbSize int64 // tamaño máximo individual kb ej: 100 AllowedExtensions string // exenciones permitidas ej: ".jpg, .png, .jpeg" ImagenWidth string // ej: 800 ImagenHeight string // ej: 600 RootFolder string //ej: static_files default "app_files" FileType string // ej: imagen,video,document,pdf SavedAsBlobInDb bool // si se guardara en el motor de la base de datos, por defecto en el disco como archivo //field FieldNameWithObjectID string //ej: id_medicalhistory Name string //ej: endoscopia, pictures Legend string //ej: Imágenes,Boletas etc DefaultEnableInput bool // si se necesita habilitado resetear el campo por defecto falso }
type FileHandler ¶ added in v0.0.59
type FileHandler interface { // PrepareFileData(header_name, extension string, form_data map[string]string) map[string]string //header_name ej: fileHeader.Filename,user_area_file ej:1,5 extension ej: .jpeg RegisterNewFile(new *FileNewToStore, form_data map[string]string) (map[string]string, error) ConfigFile() *FileConfig UploadFolderPath(form_data map[string]string) string // carpeta de destino GenerateFileNameOnDisk() string // retornar nombre de archivo sin extension FileApi }
type FileNewToStore ¶ added in v0.0.62
type FileNewToStore struct { DescriptionInputName string //name in the input. whit extension ej: perrito.jpg,boleta_123.png UploadFolder string //ej: ./files FileNameOnDisk string // no extension ej: 1223, archivo_235, 001_file FileArea string // area que tendrá el archivo ej: s,a,1,3,4 Extension string // ej .jpg,.mp4 BlobData any // data del archivo }
type FormAdapter ¶ added in v0.0.66
type FormAdapter interface {
BuildFormFields() map[string]interface{}
}
type FrontendBootActions ¶ added in v0.0.45
type FrontendBootActions interface { }
type FrontendHandler ¶ added in v0.0.46
type FrontendHandler struct { AfterCreate AfterRead AfterUpdate AfterDelete AfterClicked NotifyBootData ViewHandler ViewReset }
type Handlers ¶ added in v0.0.60
type Handlers struct { AppInfo ThemeAdapter DataBaseAdapter TimeAdapter DomAdapter HttpAdapter AuthAdapter Logger // TEST TestAdapter FileAdapter ObjectAdapter }
type HttpAdapter ¶ added in v0.0.49
type InputReset ¶ added in v0.0.61
type InputReset interface {
ResetInput()
}
type Logger ¶ added in v0.0.60
type Logger interface { // retorno una interfaz solo para simplificar funciones de tipo syscall/js Log(message ...any) interface{} }
type Module ¶
type Module struct { //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 // ej: `<div class="target-module"> // <select name="select"> // <option value="value1">Value 1</option> // <option value="value2" selected>Value 2</option> // </select> // </div>` HeaderInputTarget string //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 // tipo de entradas usadas en el modulo Inputs []*Input }
type NotifyBootData ¶ added in v0.0.50
type NotifyBootData interface {
NotifyBootDataIsLoaded()
}
type Object ¶
type Object struct { // ej: module.client, client.search_footer,user.datalist Name string Table string //tabla origen db ej: users PrincipalFieldsName []string //campos mas representativos ej: name, address, phone Fields []Field //campos *Module // módulo origen BackendHandler FrontendHandler PrinterHandler FormData map[string]string // data temporal formulario FormAdapter }
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) FieldsToFormValidate ¶ added in v0.0.66
func (Object) FilterRemoveFields ¶
func (Object) GetFieldsByNames ¶ added in v0.0.50
func (Object) GetRepresentativeTextField ¶
func (Object) GetTablesNames ¶ added in v0.0.50
func (Object) JoinFieldNames ¶ added in v0.0.48
ej: id_patient,patient_name,patient_run - add_prefix_table_name: true = patient.id_patient,patient.patient_name,patient.patient_run
func (Object) OnlyRequiredDbFieldsThisObject ¶ added in v0.0.63
solo campos requeridos en la base de datos. NOTA: puntero []*Field no funciona con slice
func (Object) PrimaryKeyName ¶
ej: "id_client", options: "add_prefix_table_name" = "client.id_client"
func (Object) RenderFields ¶
func (Object) RequiredFields ¶
func (Object) Response ¶ added in v0.0.35
options ej: update,delete,"mensaje a enviar" default action: create
type ObjectAdapter ¶ added in v0.0.66
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 JsonBootActions string //index ej <meta name="JsonBootActions" content="{{.JsonBootActions}}"> }
index.html ej: {{.StyleSheet}} {{.AppName}} {{.AppVersion}} {{.SpriteIcons}} {{.Menu}} {{.Message}} {{.UserName}} {{.UserArea}} {{.Modules}} {{.Script}} {{.Data}}
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 PrinterHandler ¶ added in v0.0.66
type PrinterHandler interface {
PrintFormObject()
}
type ReadDBParams ¶ added in v0.0.66
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 SourceData ¶ added in v0.0.44
type Subsequently ¶ added in v0.0.49
type Subsequently interface {
ActionExecutedLater()
}
acción a ejecutar posteriormente
type Tag ¶ added in v0.0.26
type Tag interface { HtmlName() string ContainerView }
type ThemeAdapter ¶ added in v0.0.47
type ThemeAdapter interface { // 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 MenuClassName() string // ej: .menu-container MenuItemClass() string // ej: navbar-item ModuleClassName() string //ej: slider_panel ModuleTemplate(m *Module, form *Object, list ContainerView) string FunctionMessageName() string // ej: ShowMessageToUser // ej query: "div#"+o.ModuleName+" [data-id='"+o.Name+"']" QuerySelectorObject(module_name, object_name string) (query string) }
type TimeAdapter ¶ added in v0.0.47
type UnixTimeHandler ¶ added in v0.0.56
type UnixTimeHandler interface {
UnixNano() int64
}
ej: time.Now()
type User ¶
type User struct { Token string // token de sesión solicitante Id string // id usuario Ip string Name string Area string //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 string // aquí valor numérico 0 a 255 LastConnection string //time.Time }
type UserAuthNumber ¶ added in v0.0.51
ej: 1 or 2 or 34 or 400.....
type UserMessage ¶ added in v0.0.52
type UserMessage interface { // retorno una interfaz solo para simplificar funciones de tipo syscall/js UserMessage(message ...any) interface{} }
type ViewHandler ¶ added in v0.0.50
type ViewHandler interface { ViewHandlerName() string ContainerView ItemView }
Source Files
¶
- adapter-api.go
- adapter-app.go
- adapter-auth.go
- adapter-boot-actions.go
- adapter-data.go
- adapter-db.go
- adapter-dom.go
- adapter-file.go
- adapter-folder-path.go
- adapter-form.go
- adapter-http.go
- adapter-logger.go
- adapter-object.go
- adapter-printer.go
- adapter-test.go
- adapter-theme.go
- adapter-time.go
- adapter-ui.go
- app-handlers.go
- db-params.go
- error.go
- field.go
- file-config.go
- icon.go
- input.go
- module-methods.go
- module.go
- object-cut-decode.go
- object-cut-encode.go
- object-message.go
- object-sql-string.go
- object-test-data.go
- object-validate.go
- object.go
- object_methods.go
- page.go
- permission.go
- request.go
- response.go
- user.go