Documentation ¶
Overview ¶
Package fileupdater 编辑内容时更新相关引用文件的关联关系 用法:fileupdater.New(fileModel.NewEmbedded(ctx)).Set(`表名称`,`字段名称`,主键ID).Add(`/test/image.jpg`,false)
Index ¶
- Variables
- func GenUpdater(m factory.Model, cond db.Compound, otherFieldAndValues ...FieldValue) func(field string, content string) error
- type CallbackFunc
- type FieldValue
- type FileUpdater
- func (f *FileUpdater) Add(content *string, embedded bool) (err error)
- func (f *FileUpdater) Delete() (err error)
- func (f *FileUpdater) Edit(content *string, embedded bool) (err error)
- func (f *FileUpdater) Handle(event string, content *string, embedded bool) error
- func (f *FileUpdater) Set(table string, field string, tableID string) *FileUpdater
- func (f *FileUpdater) SetField(field string) *FileUpdater
- func (f *FileUpdater) SetProject(project string) *FileUpdater
- func (f *FileUpdater) SetSeperator(seperator string) *FileUpdater
- func (f *FileUpdater) SetTable(table string) *FileUpdater
- func (f *FileUpdater) SetTableID(tableID string) *FileUpdater
- type Listener
- type OptionSetter
- func OptCallback(callbackFunc CallbackFunc) OptionSetter
- func OptEmbedded(embedded bool) OptionSetter
- func OptFieldName(fieldName string) OptionSetter
- func OptFieldValue(field string, value ValueFunc) OptionSetter
- func OptGenCallback(cond db.Compound, fieldValues ...FieldValue) OptionSetter
- func OptSameFields(sameFields ...string) OptionSetter
- func OptSeperator(seperator string) OptionSetter
- func OptTableName(tableName string) OptionSetter
- type Options
- type Property
- func (pro *Property) Embedded() sql.NullBool
- func (pro *Property) Exit() bool
- func (pro *Property) GenUpdater(m factory.Model, cond db.Compound, otherFieldAndValues ...FieldValue) *Property
- func (pro *Property) Seperator() sql.NullString
- func (pro *Property) SetEmbedded(on bool) *Property
- func (pro *Property) SetExit(exit bool) *Property
- func (pro *Property) SetSeperator(sep string) *Property
- func (pro *Property) SetUpdater(updater func(field string, content string) error) *Property
- func (pro *Property) Updater() func(field string, content string) error
- type Reler
- type ValueFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var Debug = false
Functions ¶
func GenUpdater ¶
func GenUpdater(m factory.Model, cond db.Compound, otherFieldAndValues ...FieldValue) func(field string, content string) error
GenUpdater 生成Updater
Types ¶
type CallbackFunc ¶
func GenCallbackDefault ¶
func GenCallbackDefault(fieldName string, fieldValues ...FieldValue) CallbackFunc
func GenCallbackWithCond ¶
func GenCallbackWithCond(cond db.Compound, fieldValues ...FieldValue) CallbackFunc
type FieldValue ¶
func FieldValueWith ¶
func FieldValueWith(field string, value ValueFunc) FieldValue
func (FieldValue) Delete ¶
func (f FieldValue) Delete(fields ...string) FieldValue
func (FieldValue) Set ¶
func (f FieldValue) Set(field string, value ValueFunc) FieldValue
type FileUpdater ¶
type FileUpdater struct {
// contains filtered or unexported fields
}
func New ¶
func New(reler Reler) *FileUpdater
func (*FileUpdater) Delete ¶
func (f *FileUpdater) Delete() (err error)
func (*FileUpdater) Handle ¶
func (f *FileUpdater) Handle(event string, content *string, embedded bool) error
func (*FileUpdater) Set ¶
func (f *FileUpdater) Set(table string, field string, tableID string) *FileUpdater
func (*FileUpdater) SetField ¶
func (f *FileUpdater) SetField(field string) *FileUpdater
func (*FileUpdater) SetProject ¶
func (f *FileUpdater) SetProject(project string) *FileUpdater
func (*FileUpdater) SetSeperator ¶
func (f *FileUpdater) SetSeperator(seperator string) *FileUpdater
func (*FileUpdater) SetTable ¶
func (f *FileUpdater) SetTable(table string) *FileUpdater
func (*FileUpdater) SetTableID ¶
func (f *FileUpdater) SetTableID(tableID string) *FileUpdater
type Listener ¶
type Listener interface { SetTableName(table string) Listener Listen() ListenByOptions(fieldName string, setters ...OptionSetter) Add(fieldName string, setters ...OptionSetter) Listener BuildOptions(fieldName string, setters ...OptionSetter) *Options Delete(fieldNames ...string) Listener }
type OptionSetter ¶
type OptionSetter func(o *Options)
func OptCallback ¶
func OptCallback(callbackFunc CallbackFunc) OptionSetter
func OptEmbedded ¶
func OptEmbedded(embedded bool) OptionSetter
func OptFieldName ¶
func OptFieldName(fieldName string) OptionSetter
func OptFieldValue ¶
func OptFieldValue(field string, value ValueFunc) OptionSetter
func OptGenCallback ¶
func OptGenCallback(cond db.Compound, fieldValues ...FieldValue) OptionSetter
func OptSameFields ¶
func OptSameFields(sameFields ...string) OptionSetter
func OptSeperator ¶
func OptSeperator(seperator string) OptionSetter
func OptTableName ¶
func OptTableName(tableName string) OptionSetter
type Options ¶
type Options struct { TableName string // 数据表名称 FieldName string // 数据表字段名 SameFields []string // 数据表类似字段名 Embedded bool // 是否为嵌入图片 Seperator string // 文件字段中多个文件路径之间的分隔符,空字符串代表为单个文件 Callback CallbackFunc `json:"-" xml:"-"` FieldValue FieldValue `json:"-" xml:"-"` }
type Property ¶
type Property struct {
// contains filtered or unexported fields
}
Property 附加属性
func NewProperty ¶
func NewProperty() *Property
func NewPropertyWith ¶
func NewPropertyWith(m factory.Model, cond db.Compound, otherFieldAndValues ...FieldValue) *Property
NewPropertyWith 创建并生成带默认Updater的实例
func (*Property) GenUpdater ¶
func (*Property) Seperator ¶
func (pro *Property) Seperator() sql.NullString
func (*Property) SetEmbedded ¶
func (*Property) SetSeperator ¶
func (*Property) SetUpdater ¶
type Reler ¶
type Reler interface { RelationFiles(project string, table string, field string, tableID string, content string, seperator ...string) error RelationEmbeddedFiles(project string, table string, field string, tableID string, content string) error DeleteByTableID(project string, table string, tableID string) error FileIDs() []uint64 ReplacedViewURLs() map[string]string Context() echo.Context }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.