revisions

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: GPL-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteRevision added in v1.7.2

func DeleteRevision(ctx context.Context, rev *Revision) error

func DeleteRevisionsByObject added in v1.7.2

func DeleteRevisionsByObject(ctx context.Context, obj attrs.Definer, getRevInfo ...QueryInfoFunc) (int64, error)

func GetRevisionData added in v1.7.2

func GetRevisionData(obj attrs.Definer, opts ...MarshallerOption) (map[string]any, error)

func MarshalRevisionData added in v1.7.2

func MarshalRevisionData(obj attrs.Definer, opts ...MarshallerOption) ([]byte, error)

func NewAppConfig

func NewAppConfig() django.AppConfig

func UnmarshalRevisionData added in v1.7.2

func UnmarshalRevisionData(obj attrs.Definer, data []byte, opts ...MarshallerOption) error

func UpdateRevision added in v1.7.2

func UpdateRevision(ctx context.Context, rev *Revision) 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 QueryInfoFunc func(ctx context.Context, obj attrs.Definer) (pk any, contentType string, err error)

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 CreateDatedRevision(ctx context.Context, forObj attrs.Definer, user users.User, at time.Time, getRevInfo ...QueryInfoFunc) (*Revision, error)

func CreateRevision added in v1.7.2

func CreateRevision(ctx context.Context, forObj attrs.Definer, user users.User, getRevInfo ...QueryInfoFunc) (*Revision, error)

func GetRevisionByID added in v1.7.2

func GetRevisionByID(ctx context.Context, id int64) (*Revision, error)

func GetRevisionsByObject added in v1.7.2

func GetRevisionsByObject(ctx context.Context, obj attrs.Definer, limit int, offset int, getRevInfo ...QueryInfoFunc) ([]*Revision, error)

func LatestRevision added in v1.7.2

func LatestRevision(ctx context.Context, obj attrs.Definer, getRevInfo ...QueryInfoFunc) (*Revision, error)

func ListRevisions added in v1.7.2

func ListRevisions(ctx context.Context, limit, offset int) ([]*Revision, error)

func NewRevision added in v1.7.2

func NewRevision(forObj attrs.Definer, user users.User, getRevInfo ...QueryInfoFunc) (*Revision, error)

func (*Revision) AsObject

func (r *Revision) AsObject(ctx context.Context) (definer attrs.Definer, err error)

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 (r *Revision) BeforeCreate(context.Context) error

func (*Revision) FieldDefs added in v1.7.2

func (r *Revision) FieldDefs() attrs.Definitions

func (*Revision) ObjectFromDB

func (r *Revision) ObjectFromDB(ctx context.Context) (attrs.Definer, error)

ObjectFromDB will return the object that this revision is for.

It will NOT populate the object with the data from the revision.

func (*Revision) OrderBy added in v1.7.2

func (r *Revision) OrderBy() []string

func (*Revision) SetObject added in v1.7.2

func (r *Revision) SetObject(obj attrs.Definer) error

type RevisionDataFieldExcluder added in v1.7.2

type RevisionDataFieldExcluder interface {
	ExcludeFromRevisionData() []string
}

type RevisionDataMarshaller added in v1.7.2

type RevisionDataMarshaller interface {
	MarshalRevisionData() (map[string]any, error)
}

type RevisionDataUnMarshaller added in v1.7.2

type RevisionDataUnMarshaller interface {
	UnmarshalRevisionData(data []byte) error
}

type RevisionInfoDefiner added in v1.7.2

type RevisionInfoDefiner interface {
	GetRevisionInfo(ctx context.Context) (pk any, contentType string, err error)
}

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 (*RevisionQuerySet) CloneQuerySet added in v1.7.2

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 (*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

type TypedRevision[T attrs.Definer] Revision

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

Jump to

Keyboard shortcuts

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