soft_delete

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: AGPL-3.0 Imports: 1 Imported by: 19 modules, 18 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// DeletedAtColumn is the default column name for soft deletes
	DeletedAtColumn = "deleted_at"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SoftDeletes

type SoftDeletes struct {
	DeletedAt *time.Time `json:"deleted_at,omitempty"`
}

SoftDeletes provides soft delete functionality for models. Models that embed this struct will have soft delete capabilities.

func (*SoftDeletes) Delete

func (sd *SoftDeletes) Delete()

Delete marks the model as deleted by setting the deleted_at timestamp.

func (*SoftDeletes) GetDeletedAt

func (sd *SoftDeletes) GetDeletedAt() *time.Time

GetDeletedAt returns the deleted_at timestamp.

func (*SoftDeletes) IsDeleted

func (sd *SoftDeletes) IsDeleted() bool

IsDeleted returns true if the model has been soft deleted.

func (*SoftDeletes) Restore

func (sd *SoftDeletes) Restore()

Restore marks the model as not deleted by setting deleted_at to nil.

Jump to

Keyboard shortcuts

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