time-tracker

module
v0.0.0-...-d26b10a Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT

README

Time Tracker

Track time across projects.

CI

Running with Docker

  1. Clone this repo
  2. Migrate database with make dbmigrate, this will create the database file dev.db under ./out folder
  3. Run docker compose up -d
  4. Access it in your browser: https://localhost:8000/

Optional:

Client

There's a web client interface for this app in the folder client, read the README.md inside to learn more.

Requirements

To run and build, you will need some dependencies and programs

Dependencies

Install modules in go.mod

go mod download
Database Migration

Install goose, a database migration tool to manage the database schema

go install github.com/pressly/goose/v3/cmd/goose@latest

Migrate the schema to the database

mkdir ./out 2>/dev/null && cd sql/schema/ && goose sqlite3 ../../out/timetracker.db up ; cd ../../

You need to be in the sql/schema folder to migrate the database

Type-Safe SQL Query Generation

Install sqlc, a sql query compiler that generates type-safe code

go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest

Whenever you modify a file in the sql folder, run the command again

sqlc generate

Building

CGO_ENABLED=1 go build -o ./out/time-tracker ./cmd/api-server

CGO_ENABLED=1 for sqlite3 driver

Running

./out/time-tracker --port 8080 --db ./out/timetracker.db

Directories

Path Synopsis
cmd
api-server command
backup command
internal
backup
Package backup provides import/export functionality to project database
Package backup provides import/export functionality to project database

Jump to

Keyboard shortcuts

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