scala.googleapis.bigquery.TableConstraints.scala Maven / Gradle / Ivy
package googleapis.bigquery
import io.circe._
import io.circe.syntax._
final case class TableConstraints(
/** Optional. Present only if the table has a foreign key. The foreign key is not enforced.
*/
foreignKeys: Option[List[TableConstraintsForeignKey]] = None,
/** Represents the primary key constraint on a table's columns.
*/
primaryKey: Option[TableConstraintsPrimaryKey] = None,
)
object TableConstraints {
implicit val encoder: Encoder[TableConstraints] = Encoder.instance { x =>
Json.obj("foreignKeys" := x.foreignKeys, "primaryKey" := x.primaryKey)
}
implicit val decoder: Decoder[TableConstraints] = Decoder.instance { c =>
for {
v0 <- c.get[Option[List[TableConstraintsForeignKey]]]("foreignKeys")
v1 <- c.get[Option[TableConstraintsPrimaryKey]]("primaryKey")
} yield TableConstraints(v0, v1)
}
}