Merge branch 'feature/database-schema' into main

Ajouter dbschema et dbstruct

Contiennent respective le schéma de base de donnée et l'objet
dbstruct.Presence, pour en manipuler les données
This commit is contained in:
Victor Lacasse-Beaudoin 2023-09-16 16:09:21 -04:00
commit 525012eee6
2 changed files with 25 additions and 0 deletions

11
dbschema/dbschema.go Normal file
View file

@ -0,0 +1,11 @@
// Package dbschema defines the database schema for the application
package dbschema
const Schema string = `
CREATE TABLE IF NOT EXISTS presences (
id VARCHAR(7) PRIMARY KEY NOT NULL,
at TIMESTAMP NOT NULL,
name VARCHAR(50) NOT NULL,
programme_id NOT NULL
);
`

14
dbstruct/dbstruct.go Normal file
View file

@ -0,0 +1,14 @@
/*
Package dbstruct provides struct types used to represent data declared in
dbschema and marshalled / unmarshalled by dbclient
*/
package dbstruct
import "time"
type Presence struct {
ID string `db:"id" json:"id" csv:"id"`
At *time.Time `db:"at" json:"at" csv:"at"`
Name string `db:"name" json:"name" csv:"name"`
ProgrammeID string `db:"programme_id" json:"programme_id" csv:"programme_id"`
}