github.com/gocaveman/caveman@v0.0.0-20191211162744-0ddf99dbdf6e/dbutil/dbutil.go (about)

     1  // Database/model utilities.
     2  package dbutil
     3  
     4  import "github.com/gocaveman/caveman/webutil"
     5  
     6  // TODO: Record locking is another pain-in-the-ass but common pattern that might be good to have a tool for.
     7  // Queues for example or tasks that can only be run on one server - you perform the lock operation atomically,
     8  // typicaly by putting a timestamp in an otherwise null field indicating the lock time and if your update worked
     9  // then you're good.  Need an unlock mechanism, an update as well in case it's a long-running thing;
    10  // And something needs to clean up old stale locks.  Was thinking
    11  // this would need to integrate with ORM tooling but realistically a database/sql solutin would probably work
    12  // just fine even when an ORM is in use.
    13  
    14  var ErrNotFound = webutil.ErrNotFound