-
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
855 additions
and
568 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
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,46 @@ | ||
// Copyright (c) 2023 Onur Cinar. All Rights Reserved. | ||
// The source code is provided under MIT License. | ||
// https://github.com/cinar/indicator | ||
|
||
package helper | ||
|
||
import "fmt" | ||
|
||
// annotationReportColumn is the annotation report column struct. | ||
type annotationReportColumn struct { | ||
ReportColumn | ||
values <-chan string | ||
} | ||
|
||
// NewAnnotationReportColumn returns a new instance of a annotation column for a report. | ||
func NewAnnotationReportColumn(values <-chan string) ReportColumn { | ||
return &annotationReportColumn{ | ||
values: values, | ||
} | ||
} | ||
|
||
// Name returns the name of the report column. | ||
func (c *annotationReportColumn) Name() string { | ||
return "" | ||
} | ||
|
||
// Type returns number as the data type. | ||
func (c *annotationReportColumn) Type() string { | ||
return "string" | ||
} | ||
|
||
// Role returns the role of the report column. | ||
func (c *annotationReportColumn) Role() string { | ||
return "annotation" | ||
} | ||
|
||
// Value returns the next data value for the report column. | ||
func (c *annotationReportColumn) Value() string { | ||
value := <-c.values | ||
|
||
if value != "" { | ||
return fmt.Sprintf("\"%s\"", value) | ||
} | ||
|
||
return "null" | ||
} |
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,42 @@ | ||
// Copyright (c) 2023 Onur Cinar. All Rights Reserved. | ||
// The source code is provided under MIT License. | ||
// https://github.com/cinar/indicator | ||
|
||
package helper | ||
|
||
import "fmt" | ||
|
||
// numericReportColumn is the number report column struct. | ||
type numericReportColumn[T Number] struct { | ||
ReportColumn | ||
name string | ||
values <-chan T | ||
} | ||
|
||
// NewNumericReportColumn returns a new instance of a numeric data column for a report. | ||
func NewNumericReportColumn[T Number](name string, values <-chan T) ReportColumn { | ||
return &numericReportColumn[T]{ | ||
name: name, | ||
values: values, | ||
} | ||
} | ||
|
||
// Name returns the name of the report column. | ||
func (c *numericReportColumn[T]) Name() string { | ||
return c.name | ||
} | ||
|
||
// Type returns number as the data type. | ||
func (c *numericReportColumn[T]) Type() string { | ||
return "number" | ||
} | ||
|
||
// Role returns the role of the report column. | ||
func (c *numericReportColumn[T]) Role() string { | ||
return "data" | ||
} | ||
|
||
// Value returns the next data value for the report column. | ||
func (c *numericReportColumn[T]) Value() string { | ||
return fmt.Sprintf("%v", <-c.values) | ||
} |
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
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
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
Oops, something went wrong.