 import Foundation
 
+/// Decodes into an entity Rows into entities, and columns into variables
 class RowDecoder : DecoderHelper {
+    /// Sets up a decoder for a row/struct/class
     required init(keyed: Row, lossyIntegers: Bool, lossyStrings: Bool) throws {
         self.either = .keyed(keyed)
         self.lossyIntegers = lossyIntegers
         self.lossyStrings = lossyStrings
     }
 
+    /// Sets up a decoder for a column (variable)
     required init(value: Column, lossyIntegers: Bool, lossyStrings: Bool) throws {
         self.either = .value(value)
         self.lossyIntegers = lossyIntegers
         self.lossyStrings = lossyStrings
     }
 
+    /// Unkeyed (arrays/sets) are not supported (yet)
     required init(unkeyed: NSNull, lossyIntegers: Bool, lossyStrings: Bool) throws {
         throw DecodingError.unimplemented
     }
 
+    /// Creates a decoder for a column. Should decode nested structs, but that's not supported (yet)
     required init(any: Column, lossyIntegers: Bool, lossyStrings: Bool) throws {
         self.either = .value(any)
         self.lossyIntegers = lossyIntegers
         self.lossyStrings = lossyStrings
     }
 
+    /// Maps a column to an integer, if it's an integer type
     func integers(for value: Column) throws -> Integers? {
         switch value {
         case .uint64(let num): return .uint64(num)

        }
    }
    
    func contains(_ key: Key) -> Bool {
        return (try? decoder.either.getKeyed().fields.contains { pair in
            return pair.field.name == key.stringValue

        }
    }
    
    /// Stores the current decoding context
    var either: Either<Column, Row, NSNull>
    
    /// Convert Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, UInt and Int automatically when possible
    ///
    /// Also converts Double and Float automatically
    var lossyIntegers: Bool
    
    /// Convert Strings and Numbers automatically when possible
    var lossyStrings: Bool
    
    /// Decodes a column to a String
    public func decode(_ type: Column) throws -> String {
        let value = try either.getValue()
        
