Documentation
¶
Index ¶
- func AppendObjectToArray[T any](pathToFile string, obj T) error
- func AppendObjectToArrayDirect[T any](pathToFile string, obj T) error
- func GetAllObjects(pathToFile string, obj interface{}) error
- func GetObjectFromIndex[T any](pathToFile string, index int) (T, error)
- func SetAllObjects(pathToFile string, obj interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendObjectToArray ¶
Appends entire object to the array in file Does not yet work on arrays in individual fields This function follows the Read-Modify-Write approach
func AppendObjectToArrayDirect ¶
AppendObjectToArrayDirect - This will not read the entire file contents to memory, but instead append it directly using writeStrings ig ! Need to fix the indenting issues. Seeking -2 works in some cases, but not during empty file & only brackets situation.
func GetAllObjects ¶
func GetObjectFromIndex ¶
Returns the individual object at the given index. Takes in the type that should be returned (This would help in typesafety as well as autocomplete) Returns error when: 1. The file is not found 2. There is some error reading the file contents 3. The actual JSON content is not an array (need it to be an array to have an index for this one) 4. The content received is not of the type passed in
* Can pass in any as the type in the function if type is not known * The function works with optional field values as well
func SetAllObjects ¶
Will see if I can work on updating modularly if possible
Types ¶
This section is empty.