Last active
August 8, 2016 12:03
-
-
Save roryl/61c1b10a8fa4c2ba542a to your computer and use it in GitHub Desktop.
Lucee Serialization Examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component { | |
this.foo = "bar"; | |
function init(){ | |
//Do something on instantiation | |
return this; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
structText = "{'BAZ':query('test':['my data']),'FOO':'bar'}"; | |
myStruct = evaluate(structText); | |
writeDump(myStruct); | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
componentText = "evaluateComponent('examples.serialization.basicComponent','c31d231165a410c67a9a8c57da575e88',{},{})"; | |
myComponent = evaluate(componentText); | |
writeDump(myComponent); | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
structText = '{"BAZ":{"COLUMNS":["TEST"],"DATA":[["my data"]]},"FOO":"bar"}'; | |
myStruct = deserializeJson(structText); | |
writeDump(myStruct); | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
basicComponent = new basicComponent(); | |
objectSave(basicComponent, "savedBasicComponent.cfc.bin"); | |
loadedBasicComponent = objectLoad("savedBasicComponent.cfc.bin"); | |
writeDump(loadedBasicComponent); | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
myStruct = {foo:"bar", baz:queryNew("test","varchar",[{test:"my data"}])}; | |
structText = serialize(myStruct); | |
echo(structText); | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
myComponent = new basicComponent(); | |
componentText = serialize(myComponent); | |
echo(componentText); | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
myStruct = {foo:"bar", baz:queryNew("test","varchar",[{test:"my data"}])}; | |
structText = serializeJson(myStruct); | |
echo(structText); | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* My xUnit Test | |
*/ | |
component extends="testbox.system.BaseSpec"{ | |
/*********************************** LIFE CYCLE Methods ***********************************/ | |
// executes before all test cases | |
function beforeTests(){ | |
} | |
// executes after all test cases | |
function afterTests(){ | |
} | |
// executes before every test case | |
function setup( currentMethod ){ | |
} | |
// executes after every test case | |
function teardown( currentMethod ){ | |
} | |
/*********************************** TEST CASES BELOW ***********************************/ | |
// Remember that test cases MUST start or end with the keyword 'test' | |
function checkAllSyntaxTest(){ | |
var files = directoryList(""); | |
for(file IN files){ | |
if(!file CONTAINS ".cfm"){ | |
//include template="#getFileFromPath(file)#"; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment