CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/golang-gorm-io--gorm

tessl install tessl/golang-gorm-io--gorm@1.31.0

Full-featured ORM library for Golang with associations, hooks, transactions, migrations, and developer-friendly chainable API

Agent Success

Agent success rate when using this tile

81%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.13x

Baseline

Agent success rate without this tile

72%

task.mdevals/scenario-10/

SQL Query Inspector

Build a tool that generates SQL statements from GORM queries without executing them, useful for query debugging and logging.

Capabilities

Generate SQL for basic operations

  • Given a simple select query with a where condition, return the generated SQL string and parameters. @test
  • Given an insert operation for a struct, return the SQL INSERT statement and parameter values. @test

Generate SQL for complex queries

  • Given a query with multiple conditions (where, order, limit), return the complete SQL statement. @test
  • Given an update operation with conditions, return the SQL UPDATE statement and parameters. @test

Implementation

@generates

The tool should accept GORM query builders and return the SQL that would be executed, along with any parameter bindings.

API

package inspector

import "gorm.io/gorm"

// GenerateSQL takes a GORM query and returns the SQL string that would be executed
// along with the parameter values. Returns an error if SQL generation fails.
func GenerateSQL(db *gorm.DB) (sql string, vars []interface{}, err error)

Dependencies { .dependencies }

gorm { .dependency }

Provides ORM functionality with SQL generation capabilities.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
golangpkg:golang/gorm.io/gorm@v1.31.1
tile.json