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

com.yourrents.services.geodata.jooq.tables.City Maven / Gradle / Ivy

The newest version!
/*
 * This file is generated by jOOQ.
 */
package com.yourrents.services.geodata.jooq.tables;

/*-
 * #%L
 * YourRents GeoData Service
 * %%
 * Copyright (C) 2023 Your Rents Team
 * %%
 * 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.
 * #L%
 */


import com.yourrents.services.geodata.jooq.Keys;
import com.yourrents.services.geodata.jooq.YrsGeodata;
import com.yourrents.services.geodata.jooq.tables.records.CityRecord;

import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.function.Function;

import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Function4;
import org.jooq.Identity;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Records;
import org.jooq.Row4;
import org.jooq.Schema;
import org.jooq.SelectField;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;


/**
 * This class is generated by jOOQ.
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class City extends TableImpl {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of yrs_geodata.city
     */
    public static final City CITY = new City();

    /**
     * The class holding records for this type
     */
    @Override
    public Class getRecordType() {
        return CityRecord.class;
    }

    /**
     * The column yrs_geodata.city.id.
     */
    public final TableField ID = createField(DSL.name("id"), SQLDataType.INTEGER.nullable(false).identity(true), this, "");

    /**
     * The column yrs_geodata.city.name.
     */
    public final TableField NAME = createField(DSL.name("name"), SQLDataType.VARCHAR(256).nullable(false), this, "");

    /**
     * The column yrs_geodata.city.province_id.
     */
    public final TableField PROVINCE_ID = createField(DSL.name("province_id"), SQLDataType.INTEGER, this, "");

    /**
     * The column yrs_geodata.city.external_id.
     */
    public final TableField EXTERNAL_ID = createField(DSL.name("external_id"), SQLDataType.UUID.nullable(false).defaultValue(DSL.field(DSL.raw("gen_random_uuid()"), SQLDataType.UUID)), this, "");

    private City(Name alias, Table aliased) {
        this(alias, aliased, null);
    }

    private City(Name alias, Table aliased, Field[] parameters) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
    }

    /**
     * Create an aliased yrs_geodata.city table reference
     */
    public City(String alias) {
        this(DSL.name(alias), CITY);
    }

    /**
     * Create an aliased yrs_geodata.city table reference
     */
    public City(Name alias) {
        this(alias, CITY);
    }

    /**
     * Create a yrs_geodata.city table reference
     */
    public City() {
        this(DSL.name("city"), null);
    }

    public  City(Table child, ForeignKey key) {
        super(child, key, CITY);
    }

    @Override
    public Schema getSchema() {
        return aliased() ? null : YrsGeodata.YRS_GEODATA;
    }

    @Override
    public Identity getIdentity() {
        return (Identity) super.getIdentity();
    }

    @Override
    public UniqueKey getPrimaryKey() {
        return Keys.CITY_PKEY;
    }

    @Override
    public List> getUniqueKeys() {
        return Arrays.asList(Keys.CITY_EXTERNAL_ID_KEY);
    }

    @Override
    public List> getReferences() {
        return Arrays.asList(Keys.CITY__FK_CITY_PROVINCE);
    }

    private transient Province _province;

    /**
     * Get the implicit join path to the yrs_geodata.province
     * table.
     */
    public Province province() {
        if (_province == null)
            _province = new Province(this, Keys.CITY__FK_CITY_PROVINCE);

        return _province;
    }

    @Override
    public City as(String alias) {
        return new City(DSL.name(alias), this);
    }

    @Override
    public City as(Name alias) {
        return new City(alias, this);
    }

    @Override
    public City as(Table alias) {
        return new City(alias.getQualifiedName(), this);
    }

    /**
     * Rename this table
     */
    @Override
    public City rename(String name) {
        return new City(DSL.name(name), null);
    }

    /**
     * Rename this table
     */
    @Override
    public City rename(Name name) {
        return new City(name, null);
    }

    /**
     * Rename this table
     */
    @Override
    public City rename(Table name) {
        return new City(name.getQualifiedName(), null);
    }

    // -------------------------------------------------------------------------
    // Row4 type methods
    // -------------------------------------------------------------------------

    @Override
    public Row4 fieldsRow() {
        return (Row4) super.fieldsRow();
    }

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Function)}.
     */
    public  SelectField mapping(Function4 from) {
        return convertFrom(Records.mapping(from));
    }

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Class,
     * Function)}.
     */
    public  SelectField mapping(Class toType, Function4 from) {
        return convertFrom(toType, Records.mapping(from));
    }
}