nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

NdbMeta.swift (4124B)


      1 // automatically generated by the FlatBuffers compiler, do not modify
      2 // swiftlint:disable all
      3 // swiftformat:disable all
      4 
      5 import FlatBuffers
      6 
      7 public struct NdbEventMeta: FlatBufferObject, Verifiable {
      8 
      9   static func validateVersion() { FlatBuffersVersion_23_5_26() }
     10   public var __buffer: ByteBuffer! { return _accessor.bb }
     11   private var _accessor: Table
     12 
     13   private init(_ t: Table) { _accessor = t }
     14   public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }
     15 
     16   private enum VTOFFSET: VOffset {
     17     case receivedAt = 4
     18     case reactions = 6
     19     case quotes = 8
     20     case reposts = 10
     21     case zaps = 12
     22     case zapTotal = 14
     23     var v: Int32 { Int32(self.rawValue) }
     24     var p: VOffset { self.rawValue }
     25   }
     26 
     27   public var receivedAt: Int32 { let o = _accessor.offset(VTOFFSET.receivedAt.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) }
     28   public var reactions: Int32 { let o = _accessor.offset(VTOFFSET.reactions.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) }
     29   public var quotes: Int32 { let o = _accessor.offset(VTOFFSET.quotes.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) }
     30   public var reposts: Int32 { let o = _accessor.offset(VTOFFSET.reposts.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) }
     31   public var zaps: Int32 { let o = _accessor.offset(VTOFFSET.zaps.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) }
     32   public var zapTotal: Int64 { let o = _accessor.offset(VTOFFSET.zapTotal.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int64.self, at: o) }
     33   public static func startNdbEventMeta(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 6) }
     34   public static func add(receivedAt: Int32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: receivedAt, def: 0, at: VTOFFSET.receivedAt.p) }
     35   public static func add(reactions: Int32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: reactions, def: 0, at: VTOFFSET.reactions.p) }
     36   public static func add(quotes: Int32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: quotes, def: 0, at: VTOFFSET.quotes.p) }
     37   public static func add(reposts: Int32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: reposts, def: 0, at: VTOFFSET.reposts.p) }
     38   public static func add(zaps: Int32, _ fbb: inout FlatBufferBuilder) { fbb.add(element: zaps, def: 0, at: VTOFFSET.zaps.p) }
     39   public static func add(zapTotal: Int64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: zapTotal, def: 0, at: VTOFFSET.zapTotal.p) }
     40   public static func endNdbEventMeta(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); return end }
     41   public static func createNdbEventMeta(
     42     _ fbb: inout FlatBufferBuilder,
     43     receivedAt: Int32 = 0,
     44     reactions: Int32 = 0,
     45     quotes: Int32 = 0,
     46     reposts: Int32 = 0,
     47     zaps: Int32 = 0,
     48     zapTotal: Int64 = 0
     49   ) -> Offset {
     50     let __start = NdbEventMeta.startNdbEventMeta(&fbb)
     51     NdbEventMeta.add(receivedAt: receivedAt, &fbb)
     52     NdbEventMeta.add(reactions: reactions, &fbb)
     53     NdbEventMeta.add(quotes: quotes, &fbb)
     54     NdbEventMeta.add(reposts: reposts, &fbb)
     55     NdbEventMeta.add(zaps: zaps, &fbb)
     56     NdbEventMeta.add(zapTotal: zapTotal, &fbb)
     57     return NdbEventMeta.endNdbEventMeta(&fbb, start: __start)
     58   }
     59 
     60   public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable {
     61     var _v = try verifier.visitTable(at: position)
     62     try _v.visit(field: VTOFFSET.receivedAt.p, fieldName: "receivedAt", required: false, type: Int32.self)
     63     try _v.visit(field: VTOFFSET.reactions.p, fieldName: "reactions", required: false, type: Int32.self)
     64     try _v.visit(field: VTOFFSET.quotes.p, fieldName: "quotes", required: false, type: Int32.self)
     65     try _v.visit(field: VTOFFSET.reposts.p, fieldName: "reposts", required: false, type: Int32.self)
     66     try _v.visit(field: VTOFFSET.zaps.p, fieldName: "zaps", required: false, type: Int32.self)
     67     try _v.visit(field: VTOFFSET.zapTotal.p, fieldName: "zapTotal", required: false, type: Int64.self)
     68     _v.finish()
     69   }
     70 }
     71