{"id":15095951,"url":"https://github.com/muthukumar89uk/go-restapi-with-sqlc","last_synced_at":"2026-02-17T07:06:37.257Z","repository":{"id":250311653,"uuid":"834088787","full_name":"muthukumar89uk/go-restapi-with-sqlc","owner":"muthukumar89uk","description":"This is a job posting project created by Golang.In it we use the SQLC tool,thats generates the type-safe code from the SQL","archived":false,"fork":false,"pushed_at":"2024-08-01T05:48:36.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T13:28:33.740Z","etag":null,"topics":["gin-gonic","golang","job-posting-application","middleware","postgresql-database","sqlc"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/muthukumar89uk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-07-26T11:48:54.000Z","updated_at":"2024-08-01T10:32:30.000Z","dependencies_parsed_at":"2024-12-06T07:41:06.519Z","dependency_job_id":"7b378e9a-b784-4fc7-bb19-5c501640e412","html_url":"https://github.com/muthukumar89uk/go-restapi-with-sqlc","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"0a19b66e0ccecfc57e2fa664ba9bf9cf56c0ef4d"},"previous_names":["muthukumar89uk/go-restapi-with-sqlc"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/muthukumar89uk/go-restapi-with-sqlc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muthukumar89uk%2Fgo-restapi-with-sqlc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muthukumar89uk%2Fgo-restapi-with-sqlc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muthukumar89uk%2Fgo-restapi-with-sqlc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muthukumar89uk%2Fgo-restapi-with-sqlc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muthukumar89uk","download_url":"https://codeload.github.com/muthukumar89uk/go-restapi-with-sqlc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muthukumar89uk%2Fgo-restapi-with-sqlc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279013517,"owners_count":26085368,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["gin-gonic","golang","job-posting-application","middleware","postgresql-database","sqlc"],"created_at":"2024-09-25T15:44:12.736Z","updated_at":"2025-10-13T03:44:03.684Z","avatar_url":"https://github.com/muthukumar89uk.png","language":"Go","readme":"# Go REST API with sqlc\n\nThis repository demonstrates how to set up a Go REST API using the `sqlc` tool for generating type-safe SQL queries from PostgreSQL database schemas.\n\n## Features\n\n- RESTful API structure\n- Type-safe SQL queries using `sqlc`\n- PostgreSQL database integration\n- CRUD operations\n\n## Requirements\n\n- Installing recent versions of sqlc requires Go 1.21+.\n- PostgreSQL\n- sqlc (installation instructions below)\n\n## Getting Started\n\n### Installation\n\n1. **Clone the repository:**\n\n    ```\n    git clone git clone https://github.com/muthukumar89uk/go-restapi-with-sqlc.git\n    ```\n   Click here to directly [download it](https://github.com/muthukumar89uk/go-restapi-with-sqlc/zipball/master).\n\n2. **Install sqlc:**\n\n    ```sh\n    go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest\n    ```\n\n3. **Install dependencies:**\n\n    ```sh\n    go mod tidy\n    ```\n### Generate Type-safe SQL Queries\n\n1. **Define SQL Queries:**\n\n    Create a `sqlc.yaml` file in your project root with the following content:\n\n    ```yaml\n    version: \"1\"\n    packages:\n      - name: \"db\"\n        path: \"internal/db\"\n        queries: \"./sql/\"\n        schema: \"./schema/\"\n        engine: \"postgresql\"\n    ```\n\n2. **Create SQL Files:**\n\n    Create a directory structure for your SQL files:\n\n    ```\n    .\n    ├── sql\n    │   ├── queries.sql\n    |   └── schema.sql\n    ```\n\n    - **sql/queries.sql:**\n\n        ```sql\n        -- name: CreateCareer :one\n       INSERT INTO career (Company,Position,Jobtype,Description,StartDate,EndDate)\n       VALUES ($1, $2,$3,$4,$5,$6)\n       RETURNING *;\n       \n       -- name: GetCareerByJobId :one\n       SELECT * FROM career\n       WHERE jobid = $1 LIMIT 1;\n       \n       -- name: GetAllCareerDetails :many\n       SELECT * FROM career;\n       \n       -- name: UpdateCareerByJobId :one\n       UPDATE career\n       SET company=$1,position=$2,jobtype=$3,description=$4\n       WHERE jobid = $5\n       RETURNING *;\n       \n       -- name: DeleteCareerByJobId :one\n       DELETE\n       FROM career\n       WHERE jobid = $1\n       RETURNING *;\n        ```\n\n    - **sql/schema.sql:**\n\n        ```sql\n       CREATE TABLE IF NOT EXISTS Career (\n          JobID  BIGSERIAL PRIMARY KEY,\n          Company VARCHAR(255) NOT NULL,\n          Position VARCHAR(255) NOT NULL,\n          Jobtype  VARCHAR(255) NOT NULL,\n          Description VARCHAR(255) NOT NULL,\n          StartDate DATE  NOT NULL ,\n          EndDate DATE NOT NULL\n        );\n        ```\n\n3. **Generate Code:**\n\n    Run the `sqlc` command to generate Go code from the SQL queries:\n\n    ```sh\n    sqlc generate\n    ```\n\n### Run the Application\n\n1. **Run the application:**\n\n    ```sh\n    go run .\n    ```\n\n2. **Access the API:**\n\n    The API will be available at `http://localhost:8080`.\n\n    **Example Endpoints:**\n\n    - `GET /get-all-career-details` - Retrieve all career-details \n    - `GET /getcareerdetail/:id` - Retrieve an career details by ID\n    - `POST /create-career` - Create a new career\n    - `PUT /updatecareer/:id` - Update an existing career\n    - `DELETE /deletecareer/:id` - Delete a career\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuthukumar89uk%2Fgo-restapi-with-sqlc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuthukumar89uk%2Fgo-restapi-with-sqlc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuthukumar89uk%2Fgo-restapi-with-sqlc/lists"}