com.tianyisoft.database.relations.BelongsTo.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of querybuilder Show documentation
Show all versions of querybuilder Show documentation
A query builder from laravel
The newest version!
package com.tianyisoft.database.relations
import com.tianyisoft.database.Builder
open class BelongsTo(
val table: String,
val foreignKey: String,
val ownerKey: String = "id"
): Builder(), Relation {
open var recursive = false
@JvmOverloads
fun withRecursive(recursive: Boolean = true): BelongsTo {
this.recursive = recursive
return this
}
override fun clone(): Any {
val belongsTo = BelongsTo(table, foreignKey, ownerKey)
belongsTo.recursive = recursive
copyAttributes(belongsTo)
return belongsTo
}
override fun copy(): BelongsTo {
return clone() as BelongsTo
}
}