internal/

directory
v0.0.0-...-a05456e Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MIT

README

/internal

Private application and library code. This is the code you don't want others importing in their applications or libraries. Note that this layout pattern is enforced by the Go compiler itself. See the Go 1.4 release notes for more details. Note that you are not limited to the top level internal directory. You can have more than one internal directory at any level of your project tree.

You can optionally add a bit of extra structure to your internal packages to separate your shared and non-shared internal code. It's not required (especially for smaller projects), but it's nice to have visual clues showing the intended package use. Your actual application code can go in the /internal/app directory (e.g., /internal/app/myapp) and the code shared by those apps in the /internal/pkg directory (e.g., /internal/pkg/myprivlib).

https://github.com/golang-standards/project-layout/tree/master/internal

/internal/api

Holds API implementations (/internal/api/handlers) and general server, router and middleware setup.

/internal/config

Holds configuration of this project (translation of ENV vars into something useable).

/internal/data

Anything data related (e.g. mappers, DAOs, DTOs, ...), may be especially relevant if you do 3rd party data integrations. Use this package to write reuseable functions for your /internal/api/handlers/*.

May hold live db fixture data (for app db seed).

/internal/i18n

Our implementation for i18n/l10n, as available via api.Server.I18n. Your own localized i18n translation bundles should live within /web/i18n.

/internal/mailer

Email handling sub-service.

/internal/models

Autogenerated SQLBoiler models. Do not put your own files in here.

These are based on your current database in ../migrations/*.sql and updated while running make.

/internal/push

Push notifications sub-service.

/internal/test

Test-Setup related code and general testing utility functions.

Holds test db fixture data (/internal/test/fixtures.go).

/internal/types

Autogenerated go-swagger types and validations. Do not put your own files in here.

These are based on your Swagger OpenAPI specification in ../api/**/*.yml and updated while running make.

/internal/util

Utility functions.

Directories

Path Synopsis
api
handlers
Code generated by go run -tags scripts scripts/handlers/gen_handlers.go; DO NOT EDIT.
Code generated by go run -tags scripts scripts/handlers/gen_handlers.go; DO NOT EDIT.
db

Jump to

Keyboard shortcuts

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