Skip to content
This repository has been archived by the owner on Jan 17, 2025. It is now read-only.

Latest commit

 

History

History
104 lines (70 loc) · 2.13 KB

DOCUMENTATION.md

File metadata and controls

104 lines (70 loc) · 2.13 KB

GOT Web Framework

Tapestry on GoLang

A Tapestry5 like WebFramework writen in GoLang
Note: This is a very early version that only contains some of the core features.
!! Don't use this in production environment. !!

Documentation

Page Lifecircle


Page value Injection

  • TODO …

Page events::RenderPage

  • Activate()
    • Called every time this page object is Activated. Page render or call event on this page.
    • ? Take no parameters.
  • Setup() or SetupRender()
  • After() or AfterRender()

Page event::FormSubmit

  • Activate()
  • OnSubmit() or OnSubmitFromTableTID()
    • before inject submit values, init fields.
  • ?? OnValidate()
    • TODO…
  • OnSuccess() or OnSuccessFromTalbeTID()
    • after inject values, do submit.
  • ?? OnValidationFailed()
  • ?? OnError()

Form Submit

Components


Templates


Got's template engine; Some Examples here:

  • If

<if t="some test">…</if>

  • Loop

<range source=".List">…

  • Component

<t:layout_leftnav CurPage="/person/list/{{.PersonType}}" /> Note that got will change the name of the attribute lowercased when attribute name doesn't match with struct's field name.

  • Use components Several method to use a component on template file. Most of them will be transformed to the last one.

    • <t:order.DetailsForm param1="value1"/>
    • <t:order_DetailsForm />
    • <div t:type="order.DetailsForm"></div>
    • {{t_order_detailsform $ "Param1" "value1"}}

Javascript files In Components

  • Example 1: Components use body only, if any.

<html>
<header><t:import> -- script & css -- <t:import></header>
<body> -- component body -- </body>
</html>

  • Example 2: if only has html tag, use contents in html tag.

<html> -- component body --</html>

  • Note: Things in <t:import> will be treated as js and css. used to remove duplication.

~~ laji ~~

inject type

go code

type OrderCreateIndex struct { core.Page Idinpath int param:"." Id int query:"id" }