{"id":38940435,"url":"https://github.com/sasakiyori/sqltext","last_synced_at":"2026-01-17T15:52:18.171Z","repository":{"id":37166690,"uuid":"503310575","full_name":"sasakiyori/sqltext","owner":"sasakiyori","description":"Simplify the plain sql text which contents comments and line feeds, also do simple grammar analysis for it. ","archived":false,"fork":false,"pushed_at":"2022-06-28T02:47:50.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-17T04:11:45.317Z","etag":null,"topics":["go","postgresql","sql","sqltext","text"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sasakiyori.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-14T10:24:23.000Z","updated_at":"2022-06-21T10:01:14.000Z","dependencies_parsed_at":"2022-09-20T21:22:10.917Z","dependency_job_id":null,"html_url":"https://github.com/sasakiyori/sqltext","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/sasakiyori/sqltext","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasakiyori%2Fsqltext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasakiyori%2Fsqltext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasakiyori%2Fsqltext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasakiyori%2Fsqltext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sasakiyori","download_url":"https://codeload.github.com/sasakiyori/sqltext/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sasakiyori%2Fsqltext/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28511851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","postgresql","sql","sqltext","text"],"created_at":"2026-01-17T15:52:18.045Z","updated_at":"2026-01-17T15:52:18.115Z","avatar_url":"https://github.com/sasakiyori.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sqltext\n![GitHub Workflow Status](https://img.shields.io/github/workflow/status/sasakiyori/sqltext/Main)\n![License](https://img.shields.io/github/license/sasakiyori/sqltext)\n![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/sasakiyori/sqltext)\n[![Coverage](https://coveralls.io/repos/github/sasakiyori/sqltext/badge.svg?branch=main\u0026service=github)](https://coveralls.io/github/sasakiyori/sqltext)\n[![GoReportCard](https://goreportcard.com/badge/sasakiyori/sqltext)](https://goreportcard.com/report/github.com/sasakiyori/sqltext)\n\n## Table of contents\n  - [Background](#background)\n  - [Features](#features)\n  - [Installation](#installation)\n  - [Usage](#usage)\n  - [Contributing](#contributing)\n  - [License](#license)\n\n## Background\nIn some scenarios, programs will receive a plain sql text from upstream and then transfer to others or execute it locally.\n\nWe can't expect the sql text is always concise and highly readable, because the habits of sql writers are different. This will confuse coders when they want to do some analysis out of database tools. Since the sql text may has messy format with a lot of comments, meaningless blank spaces and line feeds, we may need some methods to simplify the sql text.\n\nAlso the logic of a sql text can be very complex, we may need a method to find out what it does and what it affects.\n\n## Features\nThis repository supports simple grammar analysis and plain text simplifying for different query languages.\n\n|                   | mysql  | postgresql         | ...     |\n| :----:            | :----: | :----:             | :----:  |\n| Simplify Text     |        | :heavy_check_mark: |         |\n| Get Command Type  |        | :heavy_check_mark: |         |\n\n## Installation\n\n```shell\ngo get github.com/sasakiyori/sqltext\n```\n\n## Usage\n```go\n// use New() to create a processor with a specific sql type\nprocessor := sqltext.New(sqltext.Postgresql)\n// or use the specific sql type function to create a processor\nprocessor = sqltext.WithPostgresql()\n\n// only remove comments\nrc := processor.RemoveComments(text)\n// remove comments, then decrease blank spaces and line feeds, finally get an one-line sql text.\nft := processor.FormatText(text)\n\n// get the command type of sql text\ncmdType := processor.CommandType(text)\n// maybe you only consider about if the sql text is involved in write-operation or not\nreadonly := processor.Readonly(text)\n\n```\n\n## Contributing\n[Issues](https://github.com/sasakiyori/sqltext/issues/new) and [PRs](https://github.com/sasakiyori/sqltext/pulls) are welcome!\n\nThis project is just starting, lack of massy documentations, method completions, query language extensions and test case coverages. Thanks in advance to all contributors of this repository :heart:\n\n## License\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsasakiyori%2Fsqltext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsasakiyori%2Fsqltext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsasakiyori%2Fsqltext/lists"}