Skip to content

Commit 7fae157

Browse files
committed
Update objectscript-class.json
* updated method and classmethod to initialize return value variable to $$$OK and return it * added unique property with accompanying index * added computed property with initial sqlcomputecode * added date/time property with MINVAL/MAXVAL * updated query to provide SELECT/FROM/WHERE/ORDER By
1 parent d422140 commit 7fae157

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

snippets/objectscript-class.json

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,29 @@
88
"body": ["Class $1 Extends ${2:%Persistent}", "{", "$0", "}"]
99
},
1010
"ClassMethod definition": {
11-
"prefix": "ClassMethod",
12-
"body": ["ClassMethod $1($2) As ${3:%Status}", "{", "\t$0", "}"]
11+
"prefix": "ClassMethod",
12+
"body": ["ClassMethod $1($2) As ${3:%Status}", "{", "\tset $4 = \\$\\$\\$OK", "\t$0", "\treturn $4","}"]
1313
},
1414
"Method definition": {
15-
"prefix": "Method",
16-
"body": ["Method $1($2) As ${3:%Status}", "{", "\t$0", "}"]
15+
"prefix": "Method",
16+
"body": ["Method $1($2) As ${3:%Status}", "{", "\tset $4 = \\$\\$\\$OK", "\t$0", "\treturn $4", "}"]
1717
},
1818
"Property": {
1919
"prefix": "property",
2020
"body": "Property $1 As ${2:%String};"
2121
},
22+
"Unique Property": {
23+
"prefix": ["Unique", "Property"],
24+
"body": ["Property $1 As ${2:%String};", "", "Index $1Index On $1 [Unique];"]
25+
},
26+
"Always-Computed Property": {
27+
"prefix": ["Computed", "Property"],
28+
"body" : ["Property $1 As ${2:%String} [Calculated, SqlComputed, SqlComputeCode =", "{set {$1} = {$3}}];"]
29+
},
30+
"Date/Time Property": {
31+
"prefix": ["Date", "Time", "Property"],
32+
"body" : ["Property $1 as ${2|%Date,%Time|}(MINVAL = $3, MAXVAL = $4);"]
33+
},
2234
"Parameter": {
2335
"prefix": "Parameter",
2436
"body": "Parameter $1 = \"$0\";"
@@ -31,13 +43,13 @@
3143
"prefix": "Index",
3244
"body": "Index $1 On ${2:property} [Unique];",
3345
"description": "Unique Index"
34-
},
35-
"Query": {
46+
},
47+
"Query": {
3648
"prefix":["Query"],
37-
"body":["Query $1($2) As %SQLQuery [ SqlProc ]","{","\t$3","}"],
38-
"description": "Based on SQL statement"
39-
},
40-
"Trigger": {
49+
"body":["Query $1($2) As %SQLQuery [ SqlProc ]","{","\tSELECT $3", "\tFROM $4", "\tWHERE $5", "\tORDER BY $6", "}"],
50+
"description": "SQL statement"
51+
},
52+
"Trigger": {
4153
"prefix": "Trigger",
4254
"body": [
4355
"Trigger $1 [Event=${2|INSERT,UPDATE,DELETE|}, Time=${3|BEFORE,AFTER|}, Foreach=${4|row/object,row,statement|}]",

0 commit comments

Comments
 (0)