Skip to content

Instantly share code, notes, and snippets.

View calebkleveter's full-sized avatar
🔨
Build Succeeded

Caleb Kleveter calebkleveter

🔨
Build Succeeded
View GitHub Profile
public final class HTTPRequestBodySizeVerifyer: ChannelDuplexHandler, RemovableChannelHandler {
public let maxSize: Int
private var currentSize: Int
public init(maxSize: Int) {
self.maxSize = maxSize
self.currentSize = 0
}
public func channelRead(context: ChannelHandlerContext, data: NIOAny) {
import class NIO.ThreadSpecificVariable
import Foundation
import FluentKit
// MARK: - FormattedTimestampProperty
extension AnyModel {
var formattedTimestamps: [AnyFormattedTimestamp] {
return self.properties.compactMap { $0 as? AnyFormattedTimestamp }
}
protocol DataValue: Codable {
static var type: JSONType { get }
}
struct JSONType: Decodable {
private static var register: [String: JSONType] = [:]
let name: String
let decoder: (inout SingleValueDecodingContainer) throws -> DataValue
let encoder: (inout Encoder, DataValue) throws -> Void
import NIO
public final class EventLoopFutureQueue {
public enum Continue {
case success
case failure
case complete
}
public enum ContinueError: Error {
@propertyWrapper
public final class Parent<To>: AnyField, AnyEagerLoadable where To: ModelIdentifiable {
@Field public var id: To.IDValue
private var implementation: AnyField & AnyEagerLoadable
var key: String { return self.implementation.key }
var inputValue: DatabaseQuery.Value? {
get { self.implementation.inputValue }
set { self.implementation.inputValue = newValue }
extension Property {
final class Model: FluentKit.Model, AutoMigrating {
static let schema: String = "properties"
@FluentKit.ID(key: "id") var id: UUID?
@Parent(key: "preset") var preset: PropertyPreset.Model
// These are the ploymorphic properties that connect a given `Property` model row
// to any other model row. If we only want the parent to have a single `Property`, we
// can mark the `parent` field as `UINIQUE`.
[ DEBUG ] Could not load .env file: open(file:oFlag:mode:) failed: No such file or directory (errno: 2) (Vapor/Application.swift:116)
Migrate Command: Prepare
[ DEBUG ] Logging into Postgres db stairtree-sync as calebkleveter (PostgresNIO/Connection/PostgresConnection+Authenticate.swift:37)
[ DEBUG ] SELECT "fluent"."id", "fluent"."name", "fluent"."batch", "fluent"."createdAt", "fluent"."updatedAt" FROM "fluent" [] (PostgresNIO/Connection/PostgresClient+Query.swift:37)
[ ERROR ] Error(fields: [PostgresNIO.PostgresMessage.Error.Field.sqlState: "42P01", PostgresNIO.PostgresMessage.Error.Field.file: "parse_relation.c", PostgresNIO.PostgresMessage.Error.Field.line: "1180", PostgresNIO.PostgresMessage.Error.Field.position: "106", PostgresNIO.PostgresMessage.Error.Field.severity: "ERROR", PostgresNIO.PostgresMessage.Error.Field.localizedSeverity: "ERROR", PostgresNIO.PostgresMessage.Error.Field.message: "relation \"fluent\" does not exist", PostgresNIO.PostgresMessage.Error.Field.routine: "parserOpenTable"]) (Postg
[ DEBUG ] Could not load .env file: open(file:oFlag:mode:) failed: No such file or directory (errno: 2) (Vapor/Application.swift:116)
Migrate Command: Prepare
[ DEBUG ] Logging into Postgres db stairtree-sync as calebkleveter (PostgresNIO/Connection/PostgresConnection+Authenticate.swift:37)
[ DEBUG ] SELECT "fluent"."id", "fluent"."name", "fluent"."batch", "fluent"."createdAt", "fluent"."updatedAt" FROM "fluent" [] (PostgresNIO/Connection/PostgresClient+Query.swift:37)
[ DEBUG ] SELECT "fluent"."id", "fluent"."name", "fluent"."batch", "fluent"."createdAt", "fluent"."updatedAt" FROM "fluent" [] (PostgresNIO/Connection/PostgresClient+Query.swift:37)
The following migration(s) will be prepared:
+ Revision on default
+ Change on default
Would you like to continue?
y/n> y
protocol Mirrorible {
var mirror: Mirror { get }
}
extension Mirrorible {
subscript (descendant key: String) -> Any {
return self.mirror.descendant(key) as Any
}
}
➜ Failable git:(property-wrapper) ✗ swift test
<unknown>:0: error: value of optional type 'String?' must be unwrapped to a value of type 'String'
<unknown>:0: note: coalesce using '??' to provide a default when the optional value contains 'nil'
<unknown>:0: note: force-unwrap using '!' to abort execution if the optional value contains 'nil'
<unknown>:0: error: value of optional type 'String?' must be unwrapped to a value of type 'String'
<unknown>:0: note: coalesce using '??' to provide a default when the optional value contains 'nil'
<unknown>:0: note: force-unwrap using '!' to abort execution if the optional value contains 'nil'
<unknown>:0: error: value of optional type 'Int?' must be unwrapped to a value of type 'Int'
<unknown>:0: note: coalesce using '??' to provide a default when the optional value contains 'nil'
<unknown>:0: note: force-unwrap using '!' to abort execution if the optional value contains 'nil'