parameter

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2020 License: MIT Imports: 6 Imported by: 0

README

parameter

Package to manage app's parameters (configurations) in a database

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInstance

func GetInstance() *model

func LoadData

func LoadData(engine string, db *sql.DB) error

func New

func New(engine string, db *sql.DB) error

Types

type Instance added in v1.1.0

type Instance interface {
	GetString(name string) (string, bool)
	GetInt64(name string) (int64, bool)
	GetFloat64(name string) (float64, bool)
	GetTime(name, format string) (time.Time, bool)
}

type Parameter

type Parameter struct {
	ID        uint      `json:"id"`
	Name      string    `json:"name"`
	Value     string    `json:"value"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type Parameters

type Parameters []*Parameter

type Psql

type Psql struct {
	// contains filtered or unexported fields
}

type Repository

type Repository interface {
	// contains filtered or unexported methods
}

func NewRepository

func NewRepository(engine string, db *sql.DB) Repository

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(repo Repository) *Service

func (*Service) Create

func (s *Service) Create(model *Parameter) error

func (*Service) Delete

func (s *Service) Delete(id uint) error

func (*Service) GetAll

func (s *Service) GetAll() (Parameters, error)

func (*Service) GetByID

func (s *Service) GetByID(id uint) (*Parameter, error)

func (*Service) GetByName

func (s *Service) GetByName(name string) (*Parameter, error)

func (*Service) Update

func (s *Service) Update(model *Parameter) error

func (*Service) UpdateByName

func (s *Service) UpdateByName(name string, value string) error

type Servicer

type Servicer interface {
	Create(model *Parameter) error
	Update(model *Parameter) error
	UpdateByName(string, string) error
	Delete(id uint) error
	GetByID(id uint) (*Parameter, error)
	GetAll() (Parameters, error)
	GetByName(name string) (*Parameter, error)
}

Jump to

Keyboard shortcuts

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