diff --git a/dbschema/dbschema.go b/dbschema/dbschema.go new file mode 100644 index 0000000..e18b72d --- /dev/null +++ b/dbschema/dbschema.go @@ -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 +); +` diff --git a/dbstruct/dbstruct.go b/dbstruct/dbstruct.go new file mode 100644 index 0000000..8dd52e7 --- /dev/null +++ b/dbstruct/dbstruct.go @@ -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"` +}