go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/sdk/db/dialect.go (about) 1 /* 2 3 Copyright (c) 2023 - Present. Will Charczuk. All rights reserved. 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository. 5 6 */ 7 8 package db 9 10 import "strings" 11 12 // Dialect is the flavor of sql. 13 type Dialect string 14 15 // Is returns if a dialect equals one of a set of dialects. 16 func (d Dialect) Is(others ...Dialect) bool { 17 for _, other := range others { 18 if strings.EqualFold(string(d), string(other)) { 19 return true 20 } 21 } 22 return false 23 } 24 25 var ( 26 // DialectUnknown is an unknown dialect, typically inferred as DialectPostgres. 27 DialectUnknown Dialect 28 // DialectPostgres is the postgres dialect. 29 DialectPostgres Dialect = "psql" 30 // DialectCockroachDB is the crdb dialect. 31 DialectCockroachDB Dialect = "cockroachdb" 32 // DialectRedshift is the redshift dialect. 33 DialectRedshift Dialect = "redshift" 34 )