Versions in this module Expand all Collapse all v1 v1.5.3 Aug 23, 2026 v1.5.2 Aug 19, 2026 v1.5.1 Aug 19, 2026 v1.5.0 Aug 19, 2026 v1.4.0 Aug 19, 2026 v1.3.0 Jul 16, 2026 Changes in this version + const EventDelete + const EventInsert + const EventQuery + const EventUpdate + const SerializeAsNull + var DB *lucid.DB + func AddConnection(name string, db *lucid.DB) + func ApplyPool(db *lucid.DB, p PoolConfig) error + func Attach(db *lucid.DB, model any, relationName string, related ...any) error + func AutoMigrateNotifications(db *lucid.DB) error + func AutoPreload(db *lucid.DB, model any) *lucid.DB + func CachedFind(db *lucid.DB, key string, ttl time.Duration, dest any) error + func Chunk[T any](db *lucid.DB, size int, fn func(batch []T) error) error + func CloseAll() error + func Connect(driver, dsn string) (*lucid.DB, error) + func ConnectAll(configs []ConnectionConfig) error + func ConnectWithConfig(cfg ConnectConfig) (*lucid.DB, error) + func Connection(name string) *lucid.DB + func ConnectionNames() []string + func CountBy(db *lucid.DB) (int64, error) + func CreateDatabaseIfNotExists(cfg CreateConfig) error + func Debug() + func Detach(db *lucid.DB, model any, relationName string, related ...any) error + func DetachAll(db *lucid.DB, model any, relationName string) error + func Exec(db *lucid.DB, sql string, args ...any) error + func Exists(db *lucid.DB) (bool, error) + func FillableFor(model any) []string + func FirstOrCreate[T any](db *lucid.DB, where T, attrs T) (*T, error) + func ForceDelete(db *lucid.DB, model any) error + func Get() *lucid.DB + func HasRelated(db *lucid.DB, model any, relationName string, related any) (bool, error) + func IsDirty(v any, field string) bool + func IsTrashed(m *Model) bool + func Load(db *lucid.DB, model any, relations ...string) error + func MigratePivots(db *lucid.DB, models ...any) error + func MustConnection(name string) *lucid.DB + func OnlyTrashed(db *lucid.DB) *lucid.DB + func Pluck[T any](db *lucid.DB, column string) ([]T, error) + func Preload(db *lucid.DB, name string, args ...any) *lucid.DB + func PrettyPrintQueries() + func Raw(db *lucid.DB, sql string, dest any, args ...any) error + func RegisterHooks(db *lucid.DB, name string, h Hooks) + func Related(db *lucid.DB, model any, relationName string) *lucid.DB + func RequireConnection(name string) (*lucid.DB, error) + func Restore(db *lucid.DB, model any) error + func RunMigrationsFromDir(db *lucid.DB, dir string) error + func Serialize(v any, opts SerializeOptions) (map[string]any, error) + func SetDefault(name string) error + func Sync(db *lucid.DB, model any, relationName string, related ...any) error + func TableNameFor(model any) string + func Transaction(db *lucid.DB, fn func(tx *lucid.DB) error) error + func TransactionWithDB(fn func(tx *lucid.DB) error) error + func UpdateOrCreate[T any](db *lucid.DB, where T, update T) (*T, error) + func WithTrashed(db *lucid.DB) *lucid.DB + type BaseModel = Model + type ConnectConfig struct + DSN string + Debug bool + Driver string + type ConnectionConfig struct + DSN string + Debug bool + Driver string + Name string + type ConnectionManager struct + type CreateConfig struct + Database string + Driver string + Host string + Password string + Port string + User string + type CursorPaginateOptions struct + After string + Before string + Column string + Order string + PerPage int + type CursorPaginator struct + Data any + HasMore bool + NextCursor string + PerPage int + PrevCursor string + func CursorPaginate(db *lucid.DB, dest any, opts CursorPaginateOptions) (*CursorPaginator, error) + type DatabaseNotification struct + CreatedAt time.Time + Data json.RawMessage + ID string + NotifiableID string + NotifiableType string + ReadAt *time.Time + Type string + UpdatedAt time.Time + func (DatabaseNotification) TableName() string + type Factory struct + func Define(tableName string, fn func(f *Faker) map[string]any) *Factory + func (fac *Factory) Create(db *lucid.DB, attrs ...map[string]any) error + func (fac *Factory) CreateMany(db *lucid.DB, n int) error + func (fac *Factory) Merge(attrs map[string]any) *FactoryWithAttrs + type FactoryWithAttrs struct + func (f *FactoryWithAttrs) Create(db *lucid.DB) error + type Faker struct + func (f *Faker) Email() string + func (f *Faker) Int(min, max int) int + func (f *Faker) Paragraph() string + func (f *Faker) Sentence() string + func (f *Faker) Word() string + type FillableProvider interface + Fillable func() []string + type HookFunc func(db *lucid.DB) + type Hooks struct + AfterCreate HookFunc + AfterDelete HookFunc + AfterSave HookFunc + AfterUpdate HookFunc + BeforeCreate HookFunc + BeforeDelete HookFunc + BeforeSave HookFunc + BeforeUpdate HookFunc + type Migration struct + Down func(*lucid.DB) error + Name string + NonTransactional bool + Up func(*lucid.DB) error + type MigrationStatus struct + Batch int + Name string + Ran bool + RanAt string + type Migrator struct + func NewMigrator(db *lucid.DB, migrations []Migration) *Migrator + func (m *Migrator) Down() error + func (m *Migrator) Fresh() error + func (m *Migrator) PrintStatus() error + func (m *Migrator) Status() ([]MigrationStatus, error) + func (m *Migrator) Up() error + type Model struct + CreatedAt timex.Time + DeletedAt lucid.DeletedAt + ID uint + UpdatedAt timex.Time + func (m *Model) BeforeCreate(tx *gorm.DB) error + func (m *Model) BeforeUpdate(tx *gorm.DB) error + type Notifiable interface + NotifiableID func() string + NotifiableType func() string + type NotificationStore struct + DB *lucid.DB + func NewNotificationStore(db *lucid.DB) *NotificationStore + func (s *NotificationStore) All(notifiable Notifiable) ([]DatabaseNotification, error) + func (s *NotificationStore) Delete(id string) error + func (s *NotificationStore) DeleteAll(notifiable Notifiable) error + func (s *NotificationStore) MarkAllAsRead(notifiable Notifiable) error + func (s *NotificationStore) MarkAsRead(id string) error + func (s *NotificationStore) Read(notifiable Notifiable) ([]DatabaseNotification, error) + func (s *NotificationStore) Send(notifiable Notifiable, notifType string, data any) error + func (s *NotificationStore) Unread(notifiable Notifiable) ([]DatabaseNotification, error) + func (s *NotificationStore) UnreadCount(notifiable Notifiable) (int64, error) + type Paginator struct + CurrentPage int + Data any + FirstPage int + FirstPageURL string + LastPage int + LastPageURL string + NextPageURL string + PerPage int + PrevPageURL string + Total int64 + func Paginate(db *lucid.DB, dest any, page, perPage int) (*Paginator, error) + func PaginateQuery(q *lucid.DB, dest any, page, perPage int) (*Paginator, error) + func PaginateWithBaseURL(db *lucid.DB, dest any, page, perPage int, baseURL string) (*Paginator, error) + func (p *Paginator) BaseUrl(url string) *Paginator + func (p *Paginator) GetUrlsForRange(start, end int) []struct{ ... } + func (p *Paginator) Meta() map[string]any + func (p *Paginator) String() string + type PoolConfig struct + ConnMaxIdleTime time.Duration + ConnMaxLifetime time.Duration + MaxIdleConns int + MaxOpenConns int + func PoolConfigFromFields(maxOpen, maxIdle int, connMaxLifetime, connMaxIdleTime string) PoolConfig + type Query struct + func From(db *lucid.DB, table string) *Query + func On(connectionName string) *Query + func OnModel(connectionName string, model any) *Query + func QueryFor(db *lucid.DB, model any) *Query + func (q *Query) Avg(column string) (float64, error) + func (q *Query) Count() (int64, error) + func (q *Query) Create(value any) error + func (q *Query) DB() *lucid.DB + func (q *Query) Delete(value any, conds ...any) error + func (q *Query) Distinct(columns ...string) *Query + func (q *Query) Exists() (bool, error) + func (q *Query) Find(dest any, conds ...any) error + func (q *Query) First(dest any) error + func (q *Query) FirstOrFail(dest any) error + func (q *Query) Get(dest any) error + func (q *Query) GroupBy(columns ...string) *Query + func (q *Query) Having(query string, args ...any) *Query + func (q *Query) Join(query string, args ...any) *Query + func (q *Query) Last(dest any) error + func (q *Query) LeftJoin(table, condition string) *Query + func (q *Query) Limit(limit int) *Query + func (q *Query) Max(column string) (float64, error) + func (q *Query) Min(column string) (float64, error) + func (q *Query) Offset(offset int) *Query + func (q *Query) OrWhere(query any, args ...any) *Query + func (q *Query) OrderBy(value string) *Query + func (q *Query) Paginate(dest any, page, perPage int) (*Paginator, error) + func (q *Query) Pluck(column string, dest any) error + func (q *Query) Preload(name string, args ...any) *Query + func (q *Query) RightJoin(table, condition string) *Query + func (q *Query) Scopes(scopes ...func(*lucid.DB) *lucid.DB) *Query + func (q *Query) Select(columns ...string) *Query + func (q *Query) Sum(column string) (float64, error) + func (q *Query) Unscoped() *Query + func (q *Query) Update(column string, value any) error + func (q *Query) Updates(values any) error + func (q *Query) Where(query any, args ...any) *Query + func (q *Query) WhereBetween(column string, low, high any) *Query + func (q *Query) WhereIn(column string, values ...any) *Query + func (q *Query) WhereLike(column, pattern string) *Query + func (q *Query) WhereNotIn(column string, values ...any) *Query + func (q *Query) WhereNotNull(column string) *Query + func (q *Query) WhereNull(column string) *Query + func (q *Query) WhereRaw(sql string, args ...any) *Query + type QueryPayload struct + Connection string + Duration time.Duration + Error error + RowsAffected int64 + SQL string + Vars []any + type Relation struct + FieldName string + ForeignKey string + JoinForeignKey string + JoinReferences string + Kind RelationKind + LocalKey string + OwnerKey string + PivotTable string + TagRaw string + TargetType reflect.Type + func ParseRelations(model any) []Relation + type RelationKind string + const RelationBelongsTo + const RelationHasMany + const RelationHasOne + const RelationManyToMany + type RelationProvider interface + Relations func() []string + type Scope = func(db *lucid.DB) *lucid.DB + func LatestScope() Scope + func LimitScope(n int) Scope + func OldestScope() Scope + func OrderScope(column string) Scope + func WhenScope(condition bool, scope Scope) Scope + func WhereScope(query string, args ...any) Scope + type SeedFunc func(*lucid.DB) error + func (f SeedFunc) Run(db *lucid.DB) error + type SeedRunner struct + func NewSeedRunner(db *lucid.DB, seeders []Seeder) *SeedRunner + func (r *SeedRunner) Run() error + type Seeder interface + Run func(db *lucid.DB) error + type SerializeOptions struct + Omit []string + Pick []string + type SimplePaginatorResult struct + CurrentPage int + Data any + HasMore bool + PerPage int + func SimplePaginate(db *lucid.DB, dest any, page, perPage int) (*SimplePaginatorResult, error) + type TableNamer interface + Table func() string v1.2.0 Jul 15, 2026 v1.1.0 May 8, 2026 v1.0.1 May 8, 2026 v0 v0.1.9 Apr 23, 2026 v0.1.8 Apr 23, 2026 v0.1.7 Mar 16, 2026 v0.1.6 Mar 11, 2026 v0.1.5 Mar 11, 2026 v0.1.2 Mar 8, 2026 v0.1.1 Mar 8, 2026