one2many

package
v1.2.17 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindSimple

func BindSimple[LI any, RI any](binder *binding.Binder, simple *Simple[LI, RI], opts ...Option)

func QueryLeft

func QueryLeft[RI any](leftTableName string, leftRelationColumnName string,
	rightTableName string, leftQueryOrderBy string) binding.ServiceFunc[response.InfosData[RI]]

func QueryRight

func QueryRight[LI any](rightTableName string, rightRelationFieldName string, leftTableName string) binding.ServiceFunc[LI]

func QueryRightWithLeftInfo

func QueryRightWithLeftInfo[RI any, LI any](rightTableName string, rightFieldCallback ConditionFieldCallback, leftTableName string, leftRelationColumnName string) binding.ServiceFunc[response.InfosData[map[string]any]]

func UpdateLeft

func UpdateLeft(leftTableName string, leftDomainCNName string, leftRelationFieldName string, leftRelationColumnName string,
	rightTableName string, rightDomainCNName string) binding.ServiceFunc[any]

func UpdateRight

func UpdateRight(rightTableName string, rightRelationFieldName string,
	leftTableName string, leftDomainCNName string, leftRelationColumnName string) binding.ServiceFunc[any]

Types

type ConditionFieldCallback

type ConditionFieldCallback func(conditions *sql.Conditions, fieldName string, columnName string, value any) (hasDeal bool, err error)

type Option

type Option func(options *Options)

func WithDisableLeft

func WithDisableLeft() Option

func WithDisableLeftQuery

func WithDisableLeftQuery() Option

func WithDisableLeftUpdate

func WithDisableLeftUpdate() Option

func WithDisableRight

func WithDisableRight() Option

func WithDisableRightQuery

func WithDisableRightQuery() Option

func WithDisableRightUpdate

func WithDisableRightUpdate() Option

func WithDisableRightWithLeftQuery

func WithDisableRightWithLeftQuery() Option

func WithGlobalMiddlewares added in v0.8.0

func WithGlobalMiddlewares(middlewares ...binding.Middleware) Option

func WithLeftQueryMiddlewares added in v0.8.0

func WithLeftQueryMiddlewares(middlewares ...binding.Middleware) Option

func WithLeftQueryOrderBy added in v1.1.7

func WithLeftQueryOrderBy(orderBy string) Option

func WithLeftUpdateMiddlewares added in v0.8.0

func WithLeftUpdateMiddlewares(middlewares ...binding.Middleware) Option

func WithRightQueryMiddlewares added in v0.8.0

func WithRightQueryMiddlewares(middlewares ...binding.Middleware) Option

func WithRightQueryWithConditionFieldCallback

func WithRightQueryWithConditionFieldCallback(callbacks ConditionFieldCallback) Option

func WithRightUpdateMiddlewares added in v0.8.0

func WithRightUpdateMiddlewares(middlewares ...binding.Middleware) Option

func WithRightWithLeftQueryMiddlewares added in v0.8.0

func WithRightWithLeftQueryMiddlewares(middlewares ...binding.Middleware) Option

type Options

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

type Simple

type Simple[LI any, RI any] struct {
	// 左领域实体,注意是Entity类型
	Left entity.Entity

	// 右领域实体,注意是Entity类型
	Right entity.Entity

	// 数据库Schema
	Schema string

	// 更新左实体关联使用的请求参数
	LeftUpdateJsonBody request.Params

	// 查询左实体关联使用的请求参数,注意是Query类型
	LeftQueryQueryParams request.QueryWithIDRequestParams

	// 更新左实体关联使用的请求参数
	RightUpdateJsonBody request.Params

	// 查询右实体关联使用的请求参数,注意是QueryWithID类型
	RightQueryQueryParams request.QueryWithIDRequestParams

	// 查询右实体带左实体信息使用的请求参数,注意是Query类型
	RightQueryWithLeftQueryParams request.QueryRequestParams
	// contains filtered or unexported fields
}

Simple 关联的Bind参数 LI 为左边实体的Info类型 RI 为右边实体的Info类型

Jump to

Keyboard shortcuts

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