database

package
v0.0.0-...-3014034 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

README

Database

Migrations are generated using golang-migrate.

Install golang-migrate

    # brew install golang-migrate
    # go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
    # -tags are what driver we want to install on our machine

Generate migrations

action can be create / alter / drop

    migrate create -ext sql -dir database/migrations -tz Asia/Taipei -seq {action}_{table}_{detail}

Queries

If using sqlc, queries needs to be manually created in ./queries, and Go code for querying can be generated by running make sqlc command. The command will additionally generate a gomock file for Querier interface for unit tests.

Files will be created under /internal/db. DO NOT MANUALLY MODIFY GENERATED FILES. as they will be overwritten upon re-generation.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MigrationFiles embed.FS

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL