Documentation
¶
Overview ¶
MIT License
Copyright (c) 2025 OcomSoft ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertDefaultValue ¶
ConvertDefaultValue converts a YAML default value to database-specific SQL This is a common utility function that all providers can use
func FormatDefaultValue ¶
FormatDefaultValue formats a default value for use in SQL DDL. SQL expressions, numeric values, and boolean/null literals are returned verbatim. All other values are wrapped in single quotes as string literals.
func HandleFallbackDefault ¶
HandleFallbackDefault handles cases where no schema mapping exists. It normalises NULL to uppercase and delegates to FormatDefaultValue for expression detection and proper formatting.
func IsSQLExpression ¶
IsSQLExpression returns true when the value is already a valid SQL expression that should be emitted verbatim rather than wrapped in single quotes. This covers:
- Single-quoted string literals already in SQL form: 'value', '[]'::jsonb
- SQL function calls: gen_random_uuid(), uuid_generate_v4()
- Type cast expressions: '{}'::jsonb
- SQL keywords (all-uppercase, letters and underscores): CURRENT_TIMESTAMP
- NULL/null, TRUE/true, FALSE/false literals
func SafeConstraintName ¶
SafeConstraintName returns a PostgreSQL-safe constraint name (max 63 chars). If the full name exceeds 63 characters, it is truncated to 54 chars and an 8-hex-char FNV-32a hash of the original name is appended (54+1+8=63).
Types ¶
This section is empty.