File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,17 @@ public class HaystackClient {
170170 return try await post ( path: " hisRead " , args: [ " id " : id, " range " : range. toRequestString ( ) ] )
171171 }
172172
173+ public func hisWrite( id: Ref , items: [ HisItem ] ) async throws -> Grid {
174+ let builder = GridBuilder ( )
175+ builder. setMeta ( [ " id " : id] )
176+ try builder. addCol ( name: " ts " )
177+ try builder. addCol ( name: " val " )
178+ for item in items {
179+ try builder. addRow ( [ item. ts, item. val] )
180+ }
181+ return try await post ( path: " hisWrite " , grid: builder. toGrid ( ) )
182+ }
183+
173184
174185 public func watchSubCreate(
175186 watchDis: String ,
@@ -420,3 +431,13 @@ public enum HisReadRange {
420431 }
421432 }
422433}
434+
435+ public struct HisItem {
436+ let ts : DateTime
437+ let val : any Val
438+
439+ public init ( ts: DateTime , val: any Val ) {
440+ self . ts = ts
441+ self . val = val
442+ }
443+ }
You can’t perform that action at this time.
0 commit comments