-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgos.gxml
More file actions
executable file
·106 lines (97 loc) · 4.78 KB
/
gos.gxml
File metadata and controls
executable file
·106 lines (97 loc) · 4.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?xml version="1.0" encoding="UTF-8"?>
<gos>
<!--Stating the deployment type GoS should compile -->
<!-- Curent valid types are webapp,shell and bind -->
<!-- Shell = cli, sort of a GoS(Ghost) in the Shell -->
<deploy>webapp</deploy>
<port>8080</port>
<package>if-package-is-library</package>
<not_found>/your-404-page</not_found>
<error>/your-500-page</error>
<!-- Using import within different tags will have different results -->
<!-- We going to make the goPkg Mongo Db Driver available to our application -->
<!-- Using <import/> within the <go/> tag is similar to using the import call within a .go file -->
<!-- To be less dramating, GoS will skip packages that it has already imported -->
<import src="github.com/cheikhshift/tick/gos.gxml"/>
<!-- Go File output name -->
<output>server_out.go</output>
<!-- exported session fields available to Session -->
<main>
/* GOLANG SCOPE */
tick.Key = "example key 1234"
//HostName string syntax [host]:[port]
// var HostName string included on tick/gos.gxml import
HostName = "localhost:8080"
// dbs included on tick/gos.gxml import
dbs,_ = db.Connect("localhost", "database")
tick.SetDb(dbs)
obj := dbObject{Signature : "Prevent dupds" }
err := dbs.Add(&obj)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println("Use this ID to find your object : " + obj.Id.Hex())
}
</main>
<key>a very very very very secret key</key>
<!-- Declare global variables -->
<!-- Contains interfaces and structs
that will be used by the GoS application -->
<header>
<!-- remember to Jumpline when stating methods or different struct attributes, it is vital for our parser \n trick -->
<!-- Required for Gos To compile \|/-->
<!-- Required for Gos To compile \|/-->
<struct name="UserSpace">
/* Property Type */
</struct>
<object name="UserSpaceInterface" struct="UserSpace">
</object>
</header>
<methods>
<!-- Vars are defined as usual except within the var attribute for example : -->
<!-- If there is a basic go function : func hackfmt(data string, data2 string) -->
<!-- the attribute names would be called as such var="data string,data2 string" -->
<!-- Similar to a go function decleration-->
<!-- if a method matches the criteria for an interface it will be used as an interface method -->
<!-- To prevent that use the autoface attribute and set it to "false" By default it is true -->
<!-- Use the keep-local="true" attribute to limit a method within a Go file -->
<!-- Sometimes your method will return data -->
<!-- And to do so we will need to add a return var list by using the return attribute -->
<!-- Sometimes the autointerface will reuse the wrong the function, or your interface methods need a bit more distinction -->
<!-- Vis a vis which object types are used in generating these mutating methods -->
<!--Use the limit attribute to narrow down the applicable structs for this method -->
<!-- Use the object attribute to determine the name of the local variable name to be mutated within the function. By default GoS will assume object is the variable name -->
</methods>
<templates>
<!-- Template libraries are useful for expediting page creation and reuse common website elements within this GoS application -->
<!-- Templates are nested and customized with the template function instead of using the normal {{template "Name"}} call you can now use {{Button /{"Color":"#fff"}/ }}
{{Modal &{Color:"#fff"}& }} -->
<!-- *Notice that special braces are used to initialize the parameters of the struct '&{' and '}&' -->
<!-- <template name="Bootstrap_alert" tmpl="bootstrap/alert" struct="Bootstrap_alert" /> -->
</templates>
<endpoints>
<!-- Depending on your build type the usage of this tag will vary. -->
<!-- For WebServers it will override any request for a given path and run the specified method. No vars or return types are needed for -->
<!-- methods linked to an API call, please keep in mind that you may use w for http.ResponseWriter and r for http.Request . Additional available function variables is params and session. If a function is api listed it will not be used anywhere else.-->
<!-- <end /> is the endpoint tag and has the variables path,method, -->
<!-- Happy trails!!! -->
<!-- <end path="/index/api" type="POST" >
varr := "data"
fmt.Println(varr)
//response is the string variable sent -> mResponse()
response = varr
</end> -->
</endpoints>
<timers>
<!-- <timer interval="10" unit="Second" name="Updater">
var obj dbObject
var mutex = &sync.Mutex{}
mutex.Lock()
dbs.Q(&obj).Find(db.O{"_id" : bson.ObjectIdHex("598ddf137353240ba52335e1")}).One(&obj)
obj.Track = obj.Track + 1
dbs.Save(&obj)
fmt.Println("Update!")
mutex.Unlock()
</timer>
</timers> -->
</gos>