You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding support for storing snapshots with any time resolution in CSV files and File System Repository. (#268)
# Describe Request
This is to allow using different date time formats to store snapshots at
various resolutions and no longer just days.
Added support for configuring the CSV file, and the File System
Repository.
- `asset.Snapshot.Date` no longer has a date format declared as a struct
tag.
- `helper.NewCsv` takes options to configure headers, logger, and the
default date time format.
- `asset.NewFileSystemRepository` also takes CSV options to configure
the CSV files.
Example:
```golang
csv, err := helper.NewCsv[Row](
helper.WithCsvDefaultDateTimeFormat[Row]("2006-01-02 15:04:05"),
)
```
Related #266
# Change Type
New feature.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
Based on the comprehensive summary, here are the release notes:
- **New Features**
- Enhanced CSV handling with more flexible configuration options
- Introduced functional options for CSV processing
- Added new configuration methods for CSV operations
- **Improvements**
- Simplified CSV reading functions
- Removed hardcoded boolean parameters in CSV file reading
- Updated default date format handling
- **Refactoring**
- Restructured CSV-related functions to use variadic options
- Modified function signatures across multiple packages
- Streamlined CSV data processing methods
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
SnapshotsAsVolumes extracts the volume field from each snapshot in the provided channel and returns a new channel containing only those volume values.The original snapshots channel can no longer be directly used afterward.
184
184
185
185
<a name="FileSystemRepository"></a>
186
-
## type [FileSystemRepository](<https://github.com/cinar/indicator/blob/master/asset/file_system_repository.go#L20-L23>)
186
+
## type [FileSystemRepository](<https://github.com/cinar/indicator/blob/master/asset/file_system_repository.go#L20-L26>)
187
187
188
188
FileSystemRepository stores and retrieves asset snapshots using the local file system.
189
189
@@ -194,16 +194,16 @@ type FileSystemRepository struct {
AppendOrWriteToCsvFile writes the provided rows of data to the specified file, appending to the existing file if it exists or creating a new one if it doesn't. In append mode, the function assumes that the existing file's column order matches the field order of the given row struct to ensure consistent data structure.
ReadFromCsvFile creates a CSV instance, parses CSV data from the provided filename, maps the data to corresponding struct fields, and delivers it through the channel.
@@ -1095,7 +1099,7 @@ type BstNode[T Number] struct {
1095
1099
```
1096
1100
1097
1101
<aname="Csv"></a>
1098
-
## type [Csv](<https://github.com/cinar/indicator/blob/master/helper/csv.go#L40-L50>)
1102
+
## type [Csv](<https://github.com/cinar/indicator/blob/master/helper/csv.go#L40-L53>)
1099
1103
1100
1104
Csv represents the configuration for CSV reader and writer.
AppendToFile appends the provided rows of data to the end of the specified file, creating the file if it doesn't exist. In append mode, the function assumes that the existing file's column order matches the field order of the given row struct to ensure consistent data structure.
ReadFromFile parses the CSV data from the provided file name, maps the data to corresponding struct fields, and delivers the resulting rows through the channel.
ReadFromReader parses the CSV data from the provided reader, maps the data to corresponding struct fields, and delivers the resulting it through the channel.
0 commit comments