Back
get-dialect (clj)
(source)function
(get-dialect dialect)
Given a dialect name (keyword), return its definition.
Returns `nil` if the dialect is unknown.
Examples
honeysql
(ns honey.sql-test
(:refer-clojure :exclude [format])
(:require [clojure.string :as str]
[clojure.test :refer [deftest is testing]]
[honey.sql :as sut :refer [format]]
[honey.sql.helpers :as h])
#?(:clj (:import (clojure.lang ExceptionInfo))))
(deftest issue-401-dialect
(testing "registering a dialect that upper-cases idents"
(sut/register-dialect! ::MYSQL (update (sut/get-dialect :mysql) :quote comp sut/upper-case))
(is (= ["SELECT `foo` FROM `bar`"]
(sut/format {:select :foo :from :bar} {:dialect :mysql})))
(is (= ["SELECT `FOO` FROM `BAR`"]
(sut/format {:select :foo :from :bar} {:dialect ::MYSQL})))))
seancorfield/honeysql
(ns honey.sql-test
(:refer-clojure :exclude [format])
(:require [clojure.string :as str]
[clojure.test :refer [deftest is testing]]
[honey.sql :as sut :refer [format]]
[honey.sql.helpers :as h])
#?(:clj (:import (clojure.lang ExceptionInfo))))
(deftest issue-401-dialect
(testing "registering a dialect that upper-cases idents"
(sut/register-dialect! ::MYSQL (update (sut/get-dialect :mysql) :quote comp sut/upper-case))
(is (= ["SELECT `foo` FROM `bar`"]
(sut/format {:select :foo :from :bar} {:dialect :mysql})))
(is (= ["SELECT `FOO` FROM `BAR`"]
(sut/format {:select :foo :from :bar} {:dialect ::MYSQL})))))