data

package
v4.1.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiClient

type ApiClient struct {
	Key      string
	Host     string
	Port     int
	Protocol string
}

func NewApiClient

func NewApiClient(key, host, protocol string, port int) *ApiClient

func (*ApiClient) Call

func (a *ApiClient) Call(method, route string, requestBody io.Reader, useKey bool) (*http.Response, error)

func (*ApiClient) GetMembre

func (a *ApiClient) GetMembre(membreID string) (models.Membre, error)

func (*ApiClient) GetV4

func (a *ApiClient) GetV4() (string, error)

GetV4 allows checking for API v4 server health

type DataClient

type DataClient struct {
	PostgresConnection PostgresConnection
	DB                 sqlx.DB
}

DataClient is a postgres client based on sqlx

func NewDataClient

func NewDataClient(connection PostgresConnection) (*DataClient, error)

func (*DataClient) GetMembre

func (d *DataClient) GetMembre(membreID string) (models.Membre, error)

func (*DataClient) InsertMembres

func (d *DataClient) InsertMembres(membres []models.Membre) (int64, error)

InsertMembres inserts a slice of Membre into a database, returning the amount inserted and any error encountered

func (*DataClient) InsertProgrammes

func (d *DataClient) InsertProgrammes(programmes []models.Programme) (int64, error)

func (*DataClient) Seed

func (d *DataClient) Seed() (int64, error)

func (*DataClient) UpdateMembreName

func (d *DataClient) UpdateMembreName(membreID, newName string) (int64, error)

type PostgresConnection

type PostgresConnection struct {
	User     string
	Password string
	Database string
	Host     string
	Port     int
	SSL      bool
}

Jump to

Keyboard shortcuts

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