Documentation
¶
Overview ¶
Copyright © 2025 Jose Clavero Anderica (jose.clavero.anderica@gmail.com)
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 FindTablesWithAliases ¶
FindTablesWithAliases extracts table names and their corresponding aliases from a SQL query.
It analyzes the FROM clause, storing table aliases as keys in the returned map. If a table has no alias, its actual name is used as the key.
Parameters:
- query: The SQL query string to analyze.
Returns:
- A map where the key is the table alias (or the table name if no alias is used), and the value is the actual table name.
func ManipulateAST ¶
ManipulateAST modifies the SQL query by transforming column references to use the `json_extract` function in SQLite3, using the table name as the key.
SQLite3's `json_extract` function is used to extract values from JSON columns efficiently. It allows querying nested JSON fields directly within SQL queries.
Parameters:
- query: The original SQL query string to be modified.
- aliasToTable: A map that associates table aliases with their actual table names. If a table has no alias, its name is used as the alias.
Returns:
- A modified SQL query string with column references wrapped in `json_extract`.
Types ¶
type DbConf ¶
type DbConf interface {
CreateTable(string)
Insert([]unstructured.Unstructured, string)
EvaluateSelect(string) SelectResult
Destroy()
}