go-gorm / gorm

The fantastic ORM library for Golang, aims to be developer friendly

Home Page:https://gorm.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to modify sql before execute it and after build it?

QeelinDarly opened this issue · comments

Your Question

I want to modify sql which created by gorm before executed. How can I do?

I tried to create a "before" callback method, but it will be executed before create sql. I can't get sql from "originalSQL := db.Statement.SQL.String()". If you have any idea, please help.

The document you expected this should be explained

Expected answer

commented

use Dialector interface
refer to https://github.com/go-gorm/sharding