Skip to content

Instantly share code, notes, and snippets.

@djspiewak
Created October 15, 2019 23:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djspiewak/6b4b368206de5e63e4c835470924d0b3 to your computer and use it in GitHub Desktop.
Save djspiewak/6b4b368206de5e63e4c835470924d0b3 to your computer and use it in GitHub Desktop.
/*
* Copyright 2014–2019 SlamData Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package quasar.api.destination
import argonaut.CodecJson
import cats.{Eq, Show}
import cats.data.NonEmptyList
import quasar.api.table.ColumnType
import scodec.Codec
import scala.List
import java.lang.String
/**
* @see quasar.api.destination.UntypedDestination
*/
trait Destination[F[_]] {
type Type
type Constructor <: ConstructorLike
implicit val showType: Show[Type]
implicit val eqType: Eq[Type]
implicit val codecType: Codec[Type]
implicit val jsonCodecType: CodecJson[Type]
implicit val eqConstructor: Eq[Constructor]
implicit val jsonCodecConstructor: CodecJson[Constructor]
val types: List[Type]
val constructors: List[Constructor]
def coerce(tpe: ColumnType): TypeCoercion[Constructor, Type]
def destinationType: DestinationType
def sinks: NonEmptyList[ResultSink[F, Type]]
// /start-push?...
// [{"type":"blob"},{"type":"boolean"},{"constructor":"varchar","param":{"value":....}},....]
// ==> List[Type]
// VARCHAR(n) --> { "constructor": "varchar", "param-schema": {"accepts":"naturals","field":"textbox","lower-bound":1,"upper-bound":255,"power-filter":2} }
// INTEGER(signed)
trait ConstructorLike { this: Constructor =>
type Param
implicit val jsonCodecParam: CodecJson[Param]
def id: String
def apply(p: Param): Type
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment