Instrumentation¶
REL provides hooks that can be used to log or instrument your queries.
repo.Instrumentation(func(ctx context.Context, op string, message string, args ...any) func(err error) {
t := time.Now()
return func(err error) {
duration := time.Since(t)
log.Print("[duration: ", duration, " op: ", op, "] ", message, " - ", err)
}
})
This is the list for available operations:
rel-aggregate
rel-count
rel-find
rel-find-all
rel-find-and-count-all
rel-scan-one
rel-scan-all
rel-scan-multi
rel-insert
rel-insert-all
rel-update
rel-delete
rel-delete-any
rel-preload
rel-transaction
adapter-aggregate
adapter-query
adapter-exec
adapter-begin
adapter-commit
adapter-rollback
Last update: 2024-12-19