Skip to content

Commit 9688f86

Browse files
doc: Adds documentation for each Kind
1 parent 31b18d5 commit 9688f86

19 files changed

+85
-5
lines changed

Sources/Haystack/Bool.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import Foundation
22

3+
/// Bool is the truth data type with the two values `true` and `false`.
4+
///
5+
/// [Docs](https://project-haystack.org/doc/docHaystack/Kinds#bool)
36
extension Bool: Val {
47
public static var valType: ValType { .Bool }
58

Sources/Haystack/Coord.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import Foundation
22

3+
/// Coord is a specialized data type to represent a geographic coordinate as a latitude and longitude.
4+
/// Haystack uses a special atomic type for coordinates to optimize historization of geolocation for
5+
/// transportation applications (versus a collection data type such as dict).
6+
///
7+
/// [Docs](https://project-haystack.org/doc/docHaystack/Kinds#coord)
38
public struct Coord: Val {
49
public static var valType: ValType { .Coord }
510

Sources/Haystack/Date.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import Foundation
22

3+
/// Date is an ISO 8601 calendar date. It is encoded as `YYYY-MM-DD`.
4+
///
5+
/// [Docs](https://project-haystack.org/doc/docHaystack/Kinds#date)
36
public struct Date: Val {
47
public static var valType: ValType { .Date }
58

Sources/Haystack/DateTime.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import Foundation
22

3+
/// DateTime is an ISO 8601 timestamp paired with a timezone name. Haystack requires all timestamps
4+
/// to include a timezone. Timezone names are standardized in the
5+
/// [timezone database](https://project-haystack.org/doc/docHaystack/TimeZones)
6+
/// (city name from zoneinfo database). Implementations should support DateTime precision at least
7+
/// down to the millisecond.
8+
///
9+
/// [Docs](https://project-haystack.org/doc/docHaystack/Kinds#datetime)
310
public struct DateTime: Val {
411
public static var valType: ValType { .DateTime }
512
public static let utcName = "UTC"

Sources/Haystack/Dict.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import Foundation
22

3+
/// Dict (or dictionary) is the primary collection data type in Haystack. Dicts are an unordered collection of
4+
/// name/value pairs that we call *tags*. The name keys of a dict are restricted to ASCII letters, digits and
5+
/// underbar as discussed in the
6+
/// [names](https://project-haystack.org/doc/docHaystack/Kinds#names)
7+
/// section. The values may be be any other valid Haystack data type.
8+
///
9+
/// [Docs](https://project-haystack.org/doc/docHaystack/Kinds#dict)
310
public struct Dict: Val {
411
public static var valType: ValType { .Dict }
512

Sources/Haystack/Grid.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import Foundation
22

3+
/// Grid is a two dimensional tabular data type. Grids are essentially a list of dicts. However, grids may
4+
/// include grid level and column level meta data that is modeled as a dict. Grids are the fundamental
5+
/// unit of data exchange over the
6+
/// [HTTP API](https://project-haystack.org/doc/docHaystack/HttpApi).
7+
///
8+
/// [Docs](https://project-haystack.org/doc/docHaystack/Kinds#grid)
39
public struct Grid: Val {
410
public static var valType: ValType { .Grid }
511

Sources/Haystack/List.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import Foundation
22

3+
/// List is a collection data type. Lists are ordered sequences and may contain any other valid
4+
/// Haystack data types.
5+
///
6+
/// [Docs](https://project-haystack.org/doc/docHaystack/Kinds#list)
37
public struct List: Val {
48
public static var valType: ValType { .List }
59

Sources/Haystack/Marker.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import Foundation
33
/// Singleton `Marker` instance
44
public let marker = Marker()
55

6+
/// Marker is a singleton used to create "label" tags. Markers are used to express typing information.
7+
/// For example the equip tag is used on any dict that represents an equipment asset.
8+
///
9+
/// [Docs](https://project-haystack.org/doc/docHaystack/Kinds#marker)
610
public struct Marker: Val {
711
public static var valType: ValType { .Marker }
812

Sources/Haystack/NA.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import Foundation
33
/// Singleton `NA` instance
44
public let na = NA()
55

6+
/// NA is a singleton for not available. It fills a similar role as the NA constant in the R language as a place holding for
7+
/// missing or invalid data values. In Haystack it is most often used in historized data to indicate that a timestamp
8+
/// sample is in error.
9+
///
10+
/// [Docs](https://project-haystack.org/doc/docHaystack/Kinds#na)
611
public struct NA: Val {
712
public static var valType: ValType { .NA }
813

Sources/Haystack/Null.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import Foundation
22

3-
/// Singleton `NA` instance
3+
/// Singleton `null` instance
44
public let null = Null()
55

6+
/// Null is a value that maps to Haystack's null value, which is not formally defined. In some cases,
7+
/// (such as JSON coding), it is more convenient to work with a specific type instead of bridging
8+
/// Swift's nil.
69
public struct Null: Val {
710
public static var valType: ValType { .Null }
811

0 commit comments

Comments
 (0)