Documentation
¶
Index ¶
- func AuthorizationControlListHasAccess(ctx context.Context, action string, subject string) (error, bool)
- func AuthorizationControlListWrite(ctx context.Context, action string, subject string) error
- func GetEnv(key, fallback string) string
- func GetIp(r *http.Request) string
- func GetLocalIP() string
- func GetMacAddress() string
- func ToContext(ctx context.Context, service *Service) context.Context
- type BaseModel
- type BaseModelI
- type Migration
- type Option
- func Datastore(ctx context.Context, postgresqlConnection string, readOnly bool) Option
- func GrpcServer(grpcServer *grpc.Server) Option
- func HttpHandler(h http.Handler) Option
- func HttpOptions(httpOpts *server.Options) Option
- func RegisterPublisher(reference string, queueUrl string) Option
- func RegisterSubscriber(reference string, queueUrl string, concurrency int, handler SubscribeWorker) Option
- func ServerListener(listener net.Listener) Option
- func Translations(languages ...string) Option
- type Queue
- type Service
- func (s *Service) AddCleanupMethod(f func())
- func (s *Service) AddHealthCheck(checker health.Checker)
- func (s *Service) Bundle() *i18n.Bundle
- func (s *Service) DB(ctx context.Context, readOnly bool) *gorm.DB
- func (s *Service) Init(opts ...Option)
- func (s *Service) MigrateDatastore(ctx context.Context, migrationsDirPath string, migrations ...interface{}) error
- func (s Service) Publish(ctx context.Context, reference string, message []byte, ...) error
- func (s Service) QID(ctx context.Context, payload []byte) (string, error)
- func (s Service) QObject(ctx context.Context, model BaseModelI) ([]byte, map[string]string, error)
- func (s *Service) Run(ctx context.Context, address string) error
- func (s *Service) Stop()
- type SubscribeWorker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthorizationControlListHasAccess ¶ added in v1.0.5
func AuthorizationControlListWrite ¶ added in v1.0.5
func GetLocalIP ¶
func GetLocalIP() string
func GetMacAddress ¶
func GetMacAddress() string
Types ¶
type BaseModel ¶
type BaseModel struct {
ID string `gorm:"type:varchar(50);primary_key"`
CreatedAt time.Time
ModifiedAt time.Time
Version uint32 `gorm:"DEFAULT 0"`
DeletedAt gorm.DeletedAt `sql:"index"`
}
Migration Our simple table holding all the migration data
func (*BaseModel) BeforeCreate ¶
BeforeCreate Ensures we update a migrations time stamps
func (*BaseModel) BeforeUpdate ¶
BeforeUpdate Updates time stamp every time we update status of a migration
type BaseModelI ¶
type BaseModelI interface {
GetID() string
}
type Migration ¶
type Migration struct {
BaseModel
Name string `gorm:"type:varchar(50);unique_index"`
Patch string `gorm:"type:text"`
AppliedAt *time.Time
}
Migration Our simple table holding all the migration data
type Option ¶
type Option func(service *Service)
func GrpcServer ¶
func HttpHandler ¶
func HttpOptions ¶
func RegisterPublisher ¶
func RegisterSubscriber ¶
func RegisterSubscriber(reference string, queueUrl string, concurrency int, handler SubscribeWorker) Option
func ServerListener ¶
func Translations ¶ added in v1.0.5
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func FromContext ¶
func NewService ¶
func (*Service) AddCleanupMethod ¶
func (s *Service) AddCleanupMethod(f func())
func (*Service) AddHealthCheck ¶
func (*Service) MigrateDatastore ¶
func (s *Service) MigrateDatastore(ctx context.Context, migrationsDirPath string, migrations ...interface{}) error
PerformMigration finds missing migrations and records them in the database, We use the fragmenta_metadata table to do this
Click to show internal directories.
Click to hide internal directories.