authz

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ResourceTypeFeature = "feature"

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) GetCreatedAt added in v0.8.0

func (feature Feature) GetCreatedAt() time.Time

func (Feature) GetDeletedAt added in v0.8.0

func (feature Feature) GetDeletedAt() database.NullTime

func (Feature) GetDescription added in v0.8.0

func (feature Feature) GetDescription() database.NullString

func (Feature) GetFeatureId added in v0.8.0

func (feature Feature) GetFeatureId() string

func (Feature) GetID added in v0.8.0

func (feature Feature) GetID() int64

func (Feature) GetName added in v0.8.0

func (feature Feature) GetName() database.NullString

func (Feature) GetObjectId added in v0.8.0

func (feature Feature) GetObjectId() int64

func (Feature) GetUpdatedAt added in v0.8.0

func (feature Feature) GetUpdatedAt() time.Time

func (*Feature) SetDescription added in v0.8.0

func (feature *Feature) SetDescription(newDescription database.NullString)

func (*Feature) SetName added in v0.8.0

func (feature *Feature) SetName(newName database.NullString)

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 Model) (int64, error)
	GetById(ctx context.Context, id int64) (Model, error)
	GetByFeatureId(ctx context.Context, pricingTierId string) (Model, error)
	List(ctx context.Context, listParams middleware.ListParams) ([]Model, error)
	UpdateByFeatureId(ctx context.Context, pricingTierId string, feature Model) error
	DeleteByFeatureId(ctx context.Context, pricingTierId string) error
}

func NewRepository

func NewRepository(db database.Database) (FeatureRepository, error)

type FeatureService

type FeatureService struct {
	service.BaseService
	// contains filtered or unexported fields
}

func NewService

func NewService(env service.Env, repo FeatureRepository, eventSvc event.EventService, objectSvc object.ObjectService) 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) List

func (svc FeatureService) List(ctx context.Context, listParams middleware.ListParams) ([]FeatureSpec, error)

func (FeatureService) Routes added in v0.8.0

func (svc FeatureService) Routes() []service.Route

GetRoutes registers all route handlers for this module

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 Model added in v0.8.0

type Model interface {
	GetID() int64
	GetObjectId() int64
	GetFeatureId() string
	GetName() database.NullString
	SetName(database.NullString)
	GetDescription() database.NullString
	SetDescription(database.NullString)
	GetCreatedAt() time.Time
	GetUpdatedAt() time.Time
	GetDeletedAt() database.NullTime
	ToFeatureSpec() *FeatureSpec
}

type MySQLRepository

type MySQLRepository struct {
	database.SQLRepository
}

func NewMySQLRepository

func NewMySQLRepository(db *database.MySQL) MySQLRepository

func (MySQLRepository) Create

func (repo MySQLRepository) Create(ctx context.Context, model Model) (int64, error)

func (MySQLRepository) DeleteByFeatureId

func (repo MySQLRepository) DeleteByFeatureId(ctx context.Context, featureId string) error

func (MySQLRepository) GetByFeatureId

func (repo MySQLRepository) GetByFeatureId(ctx context.Context, featureId string) (Model, error)

func (MySQLRepository) GetById

func (repo MySQLRepository) GetById(ctx context.Context, id int64) (Model, error)

func (MySQLRepository) List

func (repo MySQLRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Model, error)

func (MySQLRepository) UpdateByFeatureId

func (repo MySQLRepository) UpdateByFeatureId(ctx context.Context, featureId string, model Model) error

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) Create added in v0.4.0

func (repo PostgresRepository) Create(ctx context.Context, model Model) (int64, error)

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 (repo PostgresRepository) GetByFeatureId(ctx context.Context, featureId string) (Model, error)

func (PostgresRepository) GetById added in v0.4.0

func (repo PostgresRepository) GetById(ctx context.Context, id int64) (Model, error)

func (PostgresRepository) List added in v0.4.0

func (repo PostgresRepository) List(ctx context.Context, listParams middleware.ListParams) ([]Model, error)

func (PostgresRepository) UpdateByFeatureId added in v0.4.0

func (repo PostgresRepository) UpdateByFeatureId(ctx context.Context, featureId string, model Model) error

type UpdateFeatureSpec

type UpdateFeatureSpec struct {
	Name        database.NullString `json:"name"`
	Description database.NullString `json:"description"`
}

Jump to

Keyboard shortcuts

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