Documentation
¶
Index ¶
- type Feature
- type FeatureListParamParser
- type FeatureRepository
- type FeatureService
- func (svc FeatureService) Create(ctx context.Context, featureSpec FeatureSpec) (*FeatureSpec, error)
- func (svc FeatureService) DeleteByFeatureId(ctx context.Context, featureId string) error
- func (svc FeatureService) GetByFeatureId(ctx context.Context, featureId string) (*FeatureSpec, error)
- func (svc FeatureService) GetRoutes() []service.Route
- func (svc FeatureService) List(ctx context.Context, listParams middleware.ListParams) ([]FeatureSpec, error)
- func (svc FeatureService) UpdateByFeatureId(ctx context.Context, featureId string, featureSpec UpdateFeatureSpec) (*FeatureSpec, error)
- type FeatureSpec
- type MySQLRepository
- func (repo MySQLRepository) Create(ctx context.Context, feature Feature) (int64, error)
- func (repo MySQLRepository) DeleteByFeatureId(ctx context.Context, featureId string) error
- func (repo MySQLRepository) GetByFeatureId(ctx context.Context, featureId string) (*Feature, error)
- func (repo MySQLRepository) GetById(ctx context.Context, id int64) (*Feature, error)
- func (repo MySQLRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Feature, error)
- func (repo MySQLRepository) UpdateByFeatureId(ctx context.Context, featureId string, feature Feature) error
- type PostgresRepository
- func (repo PostgresRepository) Create(ctx context.Context, feature Feature) (int64, error)
- func (repo PostgresRepository) DeleteByFeatureId(ctx context.Context, featureId string) error
- func (repo PostgresRepository) GetByFeatureId(ctx context.Context, featureId string) (*Feature, error)
- func (repo PostgresRepository) GetById(ctx context.Context, id int64) (*Feature, error)
- func (repo PostgresRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Feature, error)
- func (repo PostgresRepository) UpdateByFeatureId(ctx context.Context, featureId string, feature Feature) error
- type UpdateFeatureSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Feature ¶
type Feature struct {
ID int64 `mysql:"id" postgres:"id"`
ObjectId int64 `mysql:"objectId" postgres:"object_id"`
FeatureId string `mysql:"featureId" postgres:"feature_id"`
Name database.NullString `mysql:"name" postgres:"name"`
Description database.NullString `mysql:"description" postgres:"description"`
CreatedAt time.Time `mysql:"createdAt" postgres:"created_at"`
UpdatedAt time.Time `mysql:"updatedAt" postgres:"updated_at"`
DeletedAt database.NullTime `mysql:"deletedAt" postgres:"deleted_at"`
}
func (Feature) ToFeatureSpec ¶
func (feature Feature) ToFeatureSpec() *FeatureSpec
type FeatureListParamParser ¶
type FeatureListParamParser struct{}
func (FeatureListParamParser) GetDefaultSortBy ¶
func (parser FeatureListParamParser) GetDefaultSortBy() string
func (FeatureListParamParser) GetSupportedSortBys ¶
func (parser FeatureListParamParser) GetSupportedSortBys() []string
func (FeatureListParamParser) ParseValue ¶
func (parser FeatureListParamParser) ParseValue(val string, sortBy string) (interface{}, error)
type FeatureRepository ¶
type FeatureRepository interface {
Create(ctx context.Context, feature Feature) (int64, error)
GetById(ctx context.Context, id int64) (*Feature, error)
GetByFeatureId(ctx context.Context, pricingTierId string) (*Feature, error)
List(ctx context.Context, listParams middleware.ListParams) ([]Feature, error)
UpdateByFeatureId(ctx context.Context, pricingTierId string, feature Feature) error
DeleteByFeatureId(ctx context.Context, pricingTierId string) error
}
func NewRepository ¶
func NewRepository(db database.Database) (FeatureRepository, error)
type FeatureService ¶
type FeatureService struct {
service.BaseService
}
func NewService ¶
func NewService(env service.Env) FeatureService
func (FeatureService) Create ¶
func (svc FeatureService) Create(ctx context.Context, featureSpec FeatureSpec) (*FeatureSpec, error)
func (FeatureService) DeleteByFeatureId ¶
func (svc FeatureService) DeleteByFeatureId(ctx context.Context, featureId string) error
func (FeatureService) GetByFeatureId ¶
func (svc FeatureService) GetByFeatureId(ctx context.Context, featureId string) (*FeatureSpec, error)
func (FeatureService) GetRoutes ¶
func (svc FeatureService) GetRoutes() []service.Route
GetRoutes registers all route handlers for this module
func (FeatureService) List ¶
func (svc FeatureService) List(ctx context.Context, listParams middleware.ListParams) ([]FeatureSpec, error)
func (FeatureService) UpdateByFeatureId ¶
func (svc FeatureService) UpdateByFeatureId(ctx context.Context, featureId string, featureSpec UpdateFeatureSpec) (*FeatureSpec, error)
type FeatureSpec ¶
type FeatureSpec struct {
FeatureId string `json:"featureId" validate:"required"`
Name database.NullString `json:"name"`
Description database.NullString `json:"description"`
Context context.ContextSetSpec `json:"context,omitempty"`
CreatedAt time.Time `json:"createdAt"`
}
func (FeatureSpec) ToFeature ¶
func (spec FeatureSpec) ToFeature(objectId int64) *Feature
func (FeatureSpec) ToObjectSpec ¶
func (spec FeatureSpec) ToObjectSpec() *object.ObjectSpec
type MySQLRepository ¶
type MySQLRepository struct {
database.SQLRepository
}
func NewMySQLRepository ¶
func NewMySQLRepository(db *database.MySQL) MySQLRepository
func (MySQLRepository) DeleteByFeatureId ¶
func (repo MySQLRepository) DeleteByFeatureId(ctx context.Context, featureId string) error
func (MySQLRepository) GetByFeatureId ¶
func (MySQLRepository) List ¶
func (repo MySQLRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Feature, error)
func (MySQLRepository) UpdateByFeatureId ¶
type PostgresRepository ¶ added in v0.4.0
type PostgresRepository struct {
database.SQLRepository
}
func NewPostgresRepository ¶ added in v0.4.0
func NewPostgresRepository(db *database.Postgres) PostgresRepository
func (PostgresRepository) DeleteByFeatureId ¶ added in v0.4.0
func (repo PostgresRepository) DeleteByFeatureId(ctx context.Context, featureId string) error
func (PostgresRepository) GetByFeatureId ¶ added in v0.4.0
func (PostgresRepository) List ¶ added in v0.4.0
func (repo PostgresRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Feature, error)
func (PostgresRepository) UpdateByFeatureId ¶ added in v0.4.0
type UpdateFeatureSpec ¶
type UpdateFeatureSpec struct {
Name database.NullString `json:"name"`
Description database.NullString `json:"description"`
}
Click to show internal directories.
Click to hide internal directories.