Documentation
¶
Index ¶
- func DeleteOneQuerySchemaBuilder() *dmodel.ModelSchemaBuilder
- func ExistsQuerySchemaBuilder() *dmodel.ModelSchemaBuilder
- func GetOneQuerySchemaBuilder() *dmodel.ModelSchemaBuilder
- func InitSubModule(params InitParams) error
- func ManageAssocsSchemaBuilder() *dmodel.ModelSchemaBuilder
- func SearchQuerySchemaBuilder() *dmodel.ModelSchemaBuilder
- func SetArchivedCommandSchemaBuilder() *dmodel.ModelSchemaBuilder
- type AfterValidationFunc
- type BaseRepoGetter
- type BaseRepository
- type BeforeValidationFunc
- type CreateParam
- type DeleteOneCommand
- type DynamicModelPtr
- type ExistsQuery
- type ExistsResultData
- type GetOneQuery
- type InitParams
- type MutateResultData
- type OpResult
- type PagedResultData
- type PagingOptions
- type RepoExistsResult
- type RepoGetOneParam
- type RepoM2mAssociation
- type RepoManageM2mParam
- type RepoSearchParam
- type SearchQuery
- type SetIsArchivedCommand
- type ToDomainModelFunc
- type Validatable
- type ValidateExtraFunc
- type ValidationFlow
- func (this *ValidationFlow) End() (ft.ClientErrors, error)
- func (this *ValidationFlow) Start() *ValidationFlow
- func (this *ValidationFlow) Step(fn func(vErrs *ft.ClientErrors) error, ignoreValidationError ...bool) (out *ValidationFlow)
- func (this *ValidationFlow) StepS(fn func(vErrs *ft.ClientErrors, stop func()) error, ...) (out *ValidationFlow)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteOneQuerySchemaBuilder ¶
func DeleteOneQuerySchemaBuilder() *dmodel.ModelSchemaBuilder
func ExistsQuerySchemaBuilder ¶
func ExistsQuerySchemaBuilder() *dmodel.ModelSchemaBuilder
func GetOneQuerySchemaBuilder ¶
func GetOneQuerySchemaBuilder() *dmodel.ModelSchemaBuilder
func InitSubModule ¶
func InitSubModule(params InitParams) error
func ManageAssocsSchemaBuilder ¶
func ManageAssocsSchemaBuilder() *dmodel.ModelSchemaBuilder
func SearchQuerySchemaBuilder ¶
func SearchQuerySchemaBuilder() *dmodel.ModelSchemaBuilder
func SetArchivedCommandSchemaBuilder ¶
func SetArchivedCommandSchemaBuilder() *dmodel.ModelSchemaBuilder
Types ¶
type AfterValidationFunc ¶
type BaseRepoGetter ¶
type BaseRepoGetter interface {
GetBaseRepo() BaseRepository
}
type BaseRepository ¶
type BaseRepository interface {
// CheckUniqueCollisions returns unique key groups that have collisions. Empty slice means no collisions.
CheckUniqueCollisions(ctx corectx.Context, data dmodel.DynamicFields) (*OpResult[[][]string], error)
// DeleteOne deletes a single record by primary key then returns the number of affected rows.
// If affected rows is 0, the record is not found.
DeleteOne(ctx corectx.Context, keys dmodel.DynamicFields) (*OpResult[int], error)
// ManageM2m inserts and/or deletes junction rows for a finalized many-to-many link to dest schema.
// Source and destination are identified by id.
ManageM2m(ctx corectx.Context, param RepoManageM2mParam) (*OpResult[int], error)
Insert(ctx corectx.Context, data dmodel.DynamicFields) (*OpResult[int], error)
GetOne(ctx corectx.Context, param RepoGetOneParam) (*OpResult[dmodel.DynamicFields], error)
Search(ctx corectx.Context, param RepoSearchParam) (*OpResult[PagedResultData[dmodel.DynamicFields]], error)
Update(ctx corectx.Context, data dmodel.DynamicFields) (*OpResult[dmodel.DynamicFields], error)
Exists(ctx corectx.Context, keys []dmodel.DynamicFields) (*OpResult[RepoExistsResult], error)
GetSchema() *dmodel.ModelSchema
}
type BeforeValidationFunc ¶
type CreateParam ¶
type CreateParam[ TDomain any, TDomainPtr DynamicModelPtr[TDomain], ] struct { // Action name for logging and error messages Action string BaseRepoGetter BaseRepoGetter // Data to create Data dmodel.DynamicModelGetter // Optional function to do some processing on the domain model before validation. BeforeValidation BeforeValidationFunc[TDomainPtr] // Optional function to do some processing on the domain model after validation. AfterValidation AfterValidationFunc[TDomainPtr] // Optional function for advanced validation (business rules) in addition to built-in schema validation. ValidateExtra ValidateExtraFunc[TDomainPtr] }
type DeleteOneCommand ¶
type DynamicModelPtr ¶
type DynamicModelPtr[TDomain any] interface { *TDomain dmodel.DynamicModel }
type ExistsQuery ¶
type ExistsResultData ¶
type GetOneQuery ¶
type InitParams ¶
type MutateResultData ¶
type MutateResultData struct {
AffectedCount int `json:"affected_count"`
AffectedAt model.ModelDateTime `json:"affected_at"`
Etag model.Etag `json:"etag,omitempty"`
}
type OpResult ¶
type OpResult[TData any] struct { // The result data when success. It is only meaningful if HasData is true and ClientErrors is nil. // Otherwise, it could be nil or an empty struct. Data TData // Contains validation errors, business errors..., // or nil if there is no violation. ClientErrors ft.ClientErrors // Indicates whether "Data" is present (non-zero value: non-empty struct, non-empty array, etc.). // // If ClientErrors is nil but HasData is false, // it means the query is successfull but no data is found. HasData bool }
type PagedResultData ¶
type PagingOptions ¶
type RepoExistsResult ¶
type RepoExistsResult struct {
Existing []dmodel.DynamicFields `json:"existing"`
NotExisting []dmodel.DynamicFields `json:"not_existing"`
}
RepoExistsResult is the raw batch existence outcome per filter map (same order as input keys).
type RepoGetOneParam ¶
type RepoGetOneParam struct {
Filter dmodel.DynamicFields
Columns []string
}
type RepoM2mAssociation ¶
type RepoM2mAssociation struct {
SrcKeys dmodel.DynamicFields
DestKeys dmodel.DynamicFields
}
RepoM2mAssociation is one row to insert into the M2M junction: source entity keys and peer entity keys.
type RepoManageM2mParam ¶
type RepoSearchParam ¶
type RepoSearchParam struct {
Graph *dmodel.SearchGraph
Columns []string
Filter []dmodel.DynamicFields
Page int
Size int
}
type SearchQuery ¶
type SearchQuery struct {
Columns []string `json:"columns" query:"columns"`
Graph *dmodel.SearchGraph `json:"graph" query:"graph"`
Page int `json:"page" query:"page"`
Size int `json:"size" query:"size"`
}
type SetIsArchivedCommand ¶
type ToDomainModelFunc ¶
type ToDomainModelFunc[TDomain any] func(data dmodel.DynamicFields) TDomain
type Validatable ¶
type Validatable interface {
Validate() ft.ClientErrors
}
type ValidateExtraFunc ¶
type ValidationFlow ¶
type ValidationFlow struct {
// contains filtered or unexported fields
}
func StartValidationFlow ¶
func StartValidationFlow(startWith ...Validatable) *ValidationFlow
func (*ValidationFlow) End ¶
func (this *ValidationFlow) End() (ft.ClientErrors, error)
func (*ValidationFlow) Start ¶
func (this *ValidationFlow) Start() *ValidationFlow
func (*ValidationFlow) Step ¶
func (this *ValidationFlow) Step(fn func(vErrs *ft.ClientErrors) error, ignoreValidationError ...bool) (out *ValidationFlow)
func (*ValidationFlow) StepS ¶
func (this *ValidationFlow) StepS(fn func(vErrs *ft.ClientErrors, stop func()) error, ignoreValidationError ...bool) (out *ValidationFlow)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.