Documentation
¶
Index ¶
- func DeleteRevision(ctx context.Context, rev *Revision) error
- func DeleteRevisionsByObject(ctx context.Context, obj attrs.Definer, getRevInfo ...QueryInfoFunc) (int64, error)
- func GetRevisionData(obj attrs.Definer, opts ...MarshallerOption) (map[string]any, error)
- func MarshalRevisionData(obj attrs.Definer, opts ...MarshallerOption) ([]byte, error)
- func NewAppConfig() django.AppConfig
- func UnmarshalRevisionData(obj attrs.Definer, data []byte, opts ...MarshallerOption) error
- func UpdateRevision(ctx context.Context, rev *Revision) error
- type MarshallerOption
- type QueryInfoFunc
- type Revision
- func CreateDatedRevision(ctx context.Context, forObj attrs.Definer, user users.User, at time.Time, ...) (*Revision, error)
- func CreateRevision(ctx context.Context, forObj attrs.Definer, user users.User, ...) (*Revision, error)
- func GetRevisionByID(ctx context.Context, id int64) (*Revision, error)
- func GetRevisionsByObject(ctx context.Context, obj attrs.Definer, limit int, offset int, ...) ([]*Revision, error)
- func LatestRevision(ctx context.Context, obj attrs.Definer, getRevInfo ...QueryInfoFunc) (*Revision, error)
- func ListRevisions(ctx context.Context, limit, offset int) ([]*Revision, error)
- func NewRevision(forObj attrs.Definer, user users.User, getRevInfo ...QueryInfoFunc) (*Revision, error)
- func (r *Revision) AsObject(ctx context.Context) (definer attrs.Definer, err error)
- func (r *Revision) BeforeCreate(context.Context) error
- func (r *Revision) FieldDefs() attrs.Definitions
- func (r *Revision) ObjectFromDB(ctx context.Context) (attrs.Definer, error)
- func (r *Revision) OrderBy() []string
- func (r *Revision) SetObject(obj attrs.Definer) error
- type RevisionDataFieldExcluder
- type RevisionDataMarshaller
- type RevisionDataUnMarshaller
- type RevisionInfoDefiner
- type RevisionQuerySet
- func (w *RevisionQuerySet) Base() *queries.QuerySet[*Revision]
- func (qs *RevisionQuerySet) CloneQuerySet(...) *RevisionQuerySet
- func (qs *RevisionQuerySet) ForObjects(objs ...attrs.Definer) *RevisionQuerySet
- func (qs *RevisionQuerySet) Since(t time.Time) *RevisionQuerySet
- func (qs *RevisionQuerySet) Types(types ...any) *RevisionQuerySet
- func (qs *RevisionQuerySet) Users(users ...users.User) *RevisionQuerySet
- type RevisionsAppConfig
- type TypedRevision
- func (r *TypedRevision[T]) AsObject(ctx context.Context) (T, error)
- func (r *TypedRevision[T]) BeforeCreate(context.Context) error
- func (r *TypedRevision[T]) FieldDefs() attrs.Definitions
- func (r *TypedRevision[T]) ObjectFromDB(ctx context.Context) (T, error)
- func (r *TypedRevision[T]) OrderBy() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteRevisionsByObject ¶ added in v1.7.2
func GetRevisionData ¶ added in v1.7.2
func MarshalRevisionData ¶ added in v1.7.2
func MarshalRevisionData(obj attrs.Definer, opts ...MarshallerOption) ([]byte, error)
func NewAppConfig ¶
func UnmarshalRevisionData ¶ added in v1.7.2
func UnmarshalRevisionData(obj attrs.Definer, data []byte, opts ...MarshallerOption) error
Types ¶
type MarshallerOption ¶ added in v1.7.2
type MarshallerOption func(*marshallerOption)
func MarshallerAllowReadOnlyFields ¶ added in v1.7.2
func MarshallerAllowReadOnlyFields(b bool) MarshallerOption
func MarshallerGetFieldValue ¶ added in v1.7.2
func MarshallerGetFieldValue(fn func(def attrs.Field) (any, error)) MarshallerOption
func MarshallerSkipProxyFields ¶ added in v1.7.2
func MarshallerSkipProxyFields(b bool) MarshallerOption
type QueryInfoFunc ¶ added in v1.7.2
type Revision ¶
type Revision struct {
models.Model `table:"revisions_revision"`
ID int64 `json:"id"`
ObjectID string `json:"object_id"`
ContentType string `json:"content_type"`
Data string `json:"data"`
User users.User `json:"user"`
CreatedAt time.Time `json:"created_at"`
}
func CreateDatedRevision ¶ added in v1.7.2
func CreateRevision ¶ added in v1.7.2
func GetRevisionByID ¶ added in v1.7.2
func GetRevisionsByObject ¶ added in v1.7.2
func LatestRevision ¶ added in v1.7.2
func ListRevisions ¶ added in v1.7.2
func NewRevision ¶ added in v1.7.2
func (*Revision) AsObject ¶
AsObject will return the object that this revision is for.
It will populate the object with the data from the revision.
If the context does not return true when passed to queries.IsCommitContext the object will not be fetched from the database.
func (*Revision) BeforeCreate ¶ added in v1.7.2
func (*Revision) FieldDefs ¶ added in v1.7.2
func (r *Revision) FieldDefs() attrs.Definitions
func (*Revision) ObjectFromDB ¶
ObjectFromDB will return the object that this revision is for.
It will NOT populate the object with the data from the revision.
type RevisionDataFieldExcluder ¶ added in v1.7.2
type RevisionDataFieldExcluder interface {
ExcludeFromRevisionData() []string
}
type RevisionDataMarshaller ¶ added in v1.7.2
type RevisionDataUnMarshaller ¶ added in v1.7.2
type RevisionInfoDefiner ¶ added in v1.7.2
type RevisionQuerySet ¶ added in v1.7.2
type RevisionQuerySet struct {
*queries.WrappedQuerySet[*Revision, *RevisionQuerySet, *queries.QuerySet[*Revision]]
}
func NewRevisionQuerySet ¶ added in v1.7.2
func NewRevisionQuerySet() *RevisionQuerySet
func (*RevisionQuerySet) Base ¶ added in v1.7.2
func (w *RevisionQuerySet) Base() *queries.QuerySet[*Revision]
func (*RevisionQuerySet) CloneQuerySet ¶ added in v1.7.2
func (qs *RevisionQuerySet) CloneQuerySet(wrapped *queries.WrappedQuerySet[*Revision, *RevisionQuerySet, *queries.QuerySet[*Revision]]) *RevisionQuerySet
func (*RevisionQuerySet) ForObjects ¶ added in v1.7.2
func (qs *RevisionQuerySet) ForObjects(objs ...attrs.Definer) *RevisionQuerySet
func (*RevisionQuerySet) Since ¶ added in v1.7.2
func (qs *RevisionQuerySet) Since(t time.Time) *RevisionQuerySet
func (*RevisionQuerySet) Types ¶ added in v1.7.2
func (qs *RevisionQuerySet) Types(types ...any) *RevisionQuerySet
func (*RevisionQuerySet) Users ¶ added in v1.7.2
func (qs *RevisionQuerySet) Users(users ...users.User) *RevisionQuerySet
type RevisionsAppConfig ¶
type RevisionsAppConfig struct {
*apps.DBRequiredAppConfig
}
func App ¶
func App() *RevisionsAppConfig
type TypedRevision ¶ added in v1.7.2
func (*TypedRevision[T]) AsObject ¶ added in v1.7.2
func (r *TypedRevision[T]) AsObject(ctx context.Context) (T, error)
func (*TypedRevision[T]) BeforeCreate ¶ added in v1.7.2
func (r *TypedRevision[T]) BeforeCreate(context.Context) error
func (*TypedRevision[T]) FieldDefs ¶ added in v1.7.2
func (r *TypedRevision[T]) FieldDefs() attrs.Definitions
func (*TypedRevision[T]) ObjectFromDB ¶ added in v1.7.2
func (r *TypedRevision[T]) ObjectFromDB(ctx context.Context) (T, error)
func (*TypedRevision[T]) OrderBy ¶ added in v1.7.2
func (r *TypedRevision[T]) OrderBy() []string
Click to show internal directories.
Click to hide internal directories.