All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scala.googleapis.bigquery.ViewDefinition.scala Maven / Gradle / Ivy

There is a newer version: 0.6.1-v2-20241111
Show newest version
package googleapis.bigquery

import io.circe._
import io.circe.syntax._

final case class ViewDefinition(
    /** Describes user-defined function resources used in the query.
      */
    userDefinedFunctionResources: Option[List[UserDefinedFunctionResource]] = None,
    /** Specifies whether to use BigQuery's legacy SQL for this view. The default value is true. If set to false, the view will use BigQuery's GoogleSQL: https://cloud.google.com/bigquery/sql-reference/ Queries and views that reference this view must use the same flag value. A wrapper is used here because the default value is True.
      */
    useLegacySql: Option[Boolean] = None,
    /** Required. A query that BigQuery executes when the view is referenced.
      */
    query: Option[String] = None,
    /** Optional. Specifices the privacy policy for the view.
      */
    privacyPolicy: Option[PrivacyPolicy] = None,
    /** True if the column names are explicitly specified. For example by using the 'CREATE VIEW v(c1, c2) AS ...' syntax. Can only be set for GoogleSQL views.
      */
    useExplicitColumnNames: Option[Boolean] = None,
    /** Optional. Foreign view representations.
      */
    foreignDefinitions: Option[List[ForeignViewDefinition]] = None,
)
object ViewDefinition {
  implicit val encoder: Encoder[ViewDefinition] = Encoder.instance { x =>
    Json.obj(
      "userDefinedFunctionResources" := x.userDefinedFunctionResources,
      "useLegacySql" := x.useLegacySql,
      "query" := x.query,
      "privacyPolicy" := x.privacyPolicy,
      "useExplicitColumnNames" := x.useExplicitColumnNames,
      "foreignDefinitions" := x.foreignDefinitions,
    )
  }
  implicit val decoder: Decoder[ViewDefinition] = Decoder.instance { c =>
    for {
      v0 <- c.get[Option[List[UserDefinedFunctionResource]]]("userDefinedFunctionResources")
      v1 <- c.get[Option[Boolean]]("useLegacySql")
      v2 <- c.get[Option[String]]("query")
      v3 <- c.get[Option[PrivacyPolicy]]("privacyPolicy")
      v4 <- c.get[Option[Boolean]]("useExplicitColumnNames")
      v5 <- c.get[Option[List[ForeignViewDefinition]]]("foreignDefinitions")
    } yield ViewDefinition(v0, v1, v2, v3, v4, v5)
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy