{"id":21803057,"url":"https://github.com/litongjava/db-import-tool","last_synced_at":"2026-05-08T07:32:59.036Z","repository":{"id":242582753,"uuid":"809962701","full_name":"litongjava/db-import-tool","owner":"litongjava","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-03T19:35:54.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-22T17:51:25.476Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/litongjava.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-03T19:35:01.000Z","updated_at":"2024-07-10T03:40:06.000Z","dependencies_parsed_at":"2024-06-03T22:35:31.780Z","dependency_job_id":"95b8aa64-f904-40f4-a02f-5b9a5c528595","html_url":"https://github.com/litongjava/db-import-tool","commit_stats":null,"previous_names":["litongjava/db-improt-tool","litongjava/db-import-tool"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/litongjava/db-import-tool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litongjava%2Fdb-import-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litongjava%2Fdb-import-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litongjava%2Fdb-import-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litongjava%2Fdb-import-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/litongjava","download_url":"https://codeload.github.com/litongjava/db-import-tool/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litongjava%2Fdb-import-tool/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32771025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T02:36:36.067Z","status":"ssl_error","status_checked_at":"2026-05-08T02:36:07.210Z","response_time":54,"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":[],"created_at":"2024-11-27T11:37:48.935Z","updated_at":"2026-05-08T07:32:59.014Z","avatar_url":"https://github.com/litongjava.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# db-improt-tool\n\n## Overview\n\ndb-improt-tool is a Go application designed to read data from an Excel file and insert it into a specified database table. It supports both PostgreSQL and MySQL databases, and automatically handles inserting data without hardcoding table structures.\n\n## Features\n\n- Supports PostgreSQL and MySQL databases.\n- Reads data from an Excel file.\n- Dynamically generates SQL insert statements based on the table headers.\n- Ignores empty fields during insertion.\n- Allows disabling SSL for PostgreSQL connections.\n\n## Prerequisites\n\n- Go 1.16 or higher\n- PostgreSQL or MySQL database\n\n## Installation\n\n1. Clone the repository:\n   ```sh\n   git clone https://github.com/litongjava/db-improt-tool.git\n   cd db-improt-tool\n   ```\n\n2. Install the dependencies:\n   ```sh\n   go get -u github.com/xuri/excelize/v2\n   go get -u github.com/cloudwego/hertz/pkg/common/hlog\n   go get -u github.com/go-sql-driver/mysql\n   go get -u github.com/lib/pq\n   ```\n\n## Usage\n\n1. Compile the program:\n   ```sh\n   go build -o db-improt-tool main.go\n   ```\n\n2. Run the program with the required parameters:\n   ```sh\n   ./db-improt-tool -dsn=\"your_database_dsn\" -excel=\"path_to_your_excel_file.xlsx\" -table=\"your_table_name\"\n   ```\n\n### Example Command\n\nFor PostgreSQL:\n```sh\n./db-improt-tool -dsn=\"postgresql://username:password@127.0.0.1:15432/dbname?sslmode=false\" -excel=\"path_to_your_excel_file.xlsx\" -table=\"your_table_name\"\n```\n\nFor MySQL:\n```sh\n./db-improt-tool -dsn=\"your_mysql_dsn\" -excel=\"path_to_your_excel_file.xlsx\" -table=\"your_table_name\"\n```\n\n## Parameters\n\n- `-dsn`: The Data Source Name (DSN) for the database connection. The format depends on the database type.\n- `-excel`: The file path to the Excel file containing the data to be inserted.\n- `-table`: The name of the database table where the data will be inserted.\n\n## Code Structure\n\n- `main.go`: Main application logic including initialization, database connection, reading Excel data, and inserting data into the database.\n\n## Error Handling\n\nThe application includes basic error handling and logs any errors encountered during execution. If there is an issue with the database connection or executing the query, the error will be logged, and the program will exit.\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitongjava%2Fdb-import-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flitongjava%2Fdb-import-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitongjava%2Fdb-import-tool/lists"}