Documentation
¶
Index ¶
- Variables
- type DataStore
- type DbInstance
- func (i *DbInstance) CreatePlant(ctx context.Context, p *Plant) (*Plant, error)
- func (i *DbInstance) CreateUser(ctx context.Context, u *User) (*User, error)
- func (i *DbInstance) DeletePlant(ctx context.Context, id string) error
- func (i *DbInstance) DeleteUser(ctx context.Context, id string) error
- func (i *DbInstance) GetAllPlants(ctx context.Context) ([]*Plant, error)
- func (i *DbInstance) GetPlantByID(ctx context.Context, id string) (*Plant, error)
- func (i *DbInstance) GetUserByEmail(ctx context.Context, email string) (*User, error)
- func (i *DbInstance) GetUserByID(ctx context.Context, id string) (*User, error)
- func (i *DbInstance) GetUserByPhone(ctx context.Context, phone string) (*User, error)
- func (i *DbInstance) SetNewConnection(ctx context.Context, connStr string) error
- func (i *DbInstance) UpdatePlant(ctx context.Context, p *Plant) (*Plant, error)
- func (i *DbInstance) UpdateUser(ctx context.Context, u *User) (*User, error)
- type NewDbInstanceOpt
- type Plant
- type User
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type DataStore ¶
type DataStore interface {
SetNewConnection(ctx context.Context, connStr string) error
CreatePlant(ctx context.Context, p *Plant) (*Plant, error)
UpdatePlant(ctx context.Context, p *Plant) (*Plant, error)
GetPlantByID(ctx context.Context, id string) (*Plant, error)
GetAllPlants(ctx context.Context) ([]*Plant, error)
DeletePlant(ctx context.Context, id string) error
}
type DbInstance ¶
func Configure ¶
func Configure(opts ...NewDbInstanceOpt) (*DbInstance, error)
func (*DbInstance) CreatePlant ¶
func (*DbInstance) CreateUser ¶
func (*DbInstance) DeletePlant ¶
func (i *DbInstance) DeletePlant(ctx context.Context, id string) error
func (*DbInstance) DeleteUser ¶
func (i *DbInstance) DeleteUser(ctx context.Context, id string) error
func (*DbInstance) GetAllPlants ¶
func (i *DbInstance) GetAllPlants(ctx context.Context) ([]*Plant, error)
GetAllProducts returns all products in the database
func (*DbInstance) GetPlantByID ¶
func (*DbInstance) GetUserByEmail ¶
func (*DbInstance) GetUserByID ¶
func (*DbInstance) GetUserByPhone ¶
func (*DbInstance) SetNewConnection ¶
func (i *DbInstance) SetNewConnection(ctx context.Context, connStr string) error
func (*DbInstance) UpdatePlant ¶
func (*DbInstance) UpdateUser ¶
type NewDbInstanceOpt ¶
type NewDbInstanceOpt func(i *DbInstance) error
func WithNewConnection ¶
func WithNewConnection(conn string) NewDbInstanceOpt
func WithPool ¶
func WithPool(p *pgxpool.Pool) NewDbInstanceOpt
type Plant ¶
type Plant struct {
ID string `json:"id" db:"id"`
Name string `json:"name" db:"name"`
BotanicalName string `json:"botanical_name" db:"botanical_name"`
Description string `json:"description" db:"description"`
WaterPref string `json:"water_pref" db:"water_pref"`
LightPref string `json:"light_pref" db:"light_pref"`
HumidityPref string `json:"humidity_pref" db:"humidity_pref"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"-"`
}
type User ¶
type User struct {
ID string `json:"id"`
Name string `json:"name"`
DisplayName string `json:"display_name"`
Email string `json:"email"`
Phone string `json:"phone"`
IdpID string `json:"-"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt time.Time `json:"deleted_at"`
}
Click to show internal directories.
Click to hide internal directories.