Skip to content

Instantly share code, notes, and snippets.

package schema
import scalikejdbc.{DBSession, WrappedResultSet, SQL}
import scala.collection.immutable.ListMap
case class FK(name: String, columns: String, referenced_table: String, referenced_columns: String, on_delete: String, on_update: String)
abstract class BaseTable(private val _db: String, private val _table: String)(implicit session: DBSession) {
def createColumn(meta: Map[String, Option[String]]): Int
package models
import play.api.db.slick.Config.driver.simple._
import java.sql.Timestamp
case class ChartCase(id: Option[Long], title: String, query: String, settings: String, db: String, user: Long,
conn: Long, created: Timestamp, team_shared: Boolean = false, public: Boolean = false)
class Chart(tag: Tag) extends Table[ChartCase](tag, "charts") {
def id = column[Long]("id", O.PrimaryKey, O.AutoInc)
@lauris
lauris / municipalities.json
Created July 13, 2018 08:49
List of municipalities in Latvia
[
{
"title":"Aglonas novada pašvaldība",
"url":"http://www.aglona.lv"
},
{
"title":"Aizkraukles novada pašvaldība",
"url":"http://www.aizkraukle.lv"
},
{
@lauris
lauris / mongodb-monthly.js
Created May 14, 2020 09:40
MongoDB aggregate entries by month
db.getCollection('users').aggregate(
[
{
$group:
{
_id:
{
month: { $month: "$created" },
year: { $year: "$created" }
},