Sqlfile
A Golang library for executing SQL file easily. (support multiple queries execution)
Install / Use
/learn @tanimutomo/SqlfileREADME
sqlfile
A Golang library for treating SQL file.
sqlfile can execute multiple queries defined in .sql file with database/sql
Installation
go get github.com/tanimutomo/sqlfile
Usage
SQL) Prepare sql file.
Don't forget add ; at last of each query.
-- example.sql
INSERT INTO users ( -- users table
id, name, email, created_at, updated_at
) VALUES (
1, 'user1', 'user1@example.com', now(), now()
);
INSERT INTO articles ( -- articles table
id, user_id, title, content, created_at, updated_at
) VALUES (
1, 1, 'title1', "-- About -- \n I'm sqlfile.", now(), now() -- post1
), (
2, 1, 'title2', '- About - \n I''m sqlfile.', now(), now() -- post2
);
Go) Load and Execute sql file.
import (
"database/sql"
"github.com/tanimutomo/sqlfile"
)
// Get a database handler
db, err := sql.Open("DBMS", "CONNECTION")
// Initialize SqlFile
s := sqlfile.New()
// Load input file and store queries written in the file
err := s.File("example.sql")
// Load input files and store queries written in the files
err := s.Files("example.sql", "example2.sql")
// Load files in the input directory and store queries written in the files
err := s.Directory("./examples")
// Execute the stored queries
// transaction is used to execute queries in Exec()
res, err := s.Exec(db)
Related Skills
oracle
351.8kBest practices for using the oracle CLI (prompt + file bundling, engines, sessions, and file attachment patterns).
xurl
351.8kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
prose
351.8kOpenProse VM skill pack. Activate on any `prose` command, .prose files, or OpenProse mentions; orchestrates multi-agent workflows.
Command Development
110.9kThis skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
