soft_delete

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

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