Skip to content
StevenAlexanderJohnson edited this page Mar 27, 2024 · 2 revisions

Welcome to the dbAdmin wiki!

dbAdmin is written using Wails.

It uses Svelte as the frontend framework.

General Code Standards

Structs and Interfaces

For this project when creating a struct that should fulfil an interface, do not embed the interface within the struct.

Example of bad code:

type animal interface {
    breed() string
}

type goldenRetriever struct {
    animal
    age int
}

Example of good code:

type animal interface c{
    breed() string
}

type goldenRetriever struct {
    age int
}

type (d *Dog) breed() string {
    return "Golden Retriever"
}

When you embed that interface within the struct, it hides compilation errors that state the struct does not fulfil the interface.

In the embedding example it would not throw an error in the following code until runtime.

var a animal
a = goldenRetriever{age:1}
a.breed()

If you did not embed the interface within the struct you would not be able to assign goldenRetriever to animal until goldenRetriver had the breed method.

File Management

For now keep all Go files within the base directory and in the main package. This keeps things simplified.

This project will most likely not have external services required like an external API. In the case that one of these are required, create a new package that will encapsulate that whole service.

External databases are not included due to the purpose of the application to interact with them. It is part of the main functionality.

Frontend

The frontend is built using Svelte and should follow best practices outlined by that community.

It uses svelt-spa-router to handle routing between pages. Each page should be held within the /frontend/src/pages folder.

Anytime you would create a reusable component that is imported into a page, place that component in the /frontend/src/lib folder.

Do not touch any of the wailsjs folder. These folders and their contents are generated by Wails, and do not require us to interact with them.

Clone this wiki locally