-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs for create-attributes, created the intro and the CreateStringAtt…
…ribute
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Usage of CreateAttribute methods | ||
|
||
Attributes that are available: | ||
- string | ||
- Enum | ||
- Ip | ||
- Url | ||
- Integer | ||
- Float | ||
- Boolean | ||
|
||
Note: for the optional parameters, there is new type created (since GO doesn't have optional or default arguments). The Optional type is defined as a struct with fields: | ||
|
||
- Value -> this contains the value | ||
- Specified -> wether or not it is specified (defaults to false) | ||
|
||
Optional[T]{} -> replace T with the desired type (string, int, ...) | ||
empty optional = will see as "optional value not set" | ||
|
||
Example Use of the CreateAttribute functions: | ||
|
||
CreateStringAttribute("unique()", "StringName", 15, false, Optional[string]{Value: "MyDefaultString",Specified: false}, Optional[bool]{}) | ||
This wil create a String attribute with name "StringName" that is max. 15 characters long and has default value "MyDefaultString". Since the isArray is an empty Optional[bool], the isArray bool will be false -> this is not an array |