All Versions
12
Latest Version
Avg Release Cycle
70 days
Latest Release
1273 days ago

Changelog History
Page 2

  • v1.1.0

    • โœ… Caching - caching with Redis or (in-memory for testing)
    • ๐ŸŒฒ LogQueriesThreshold - log slow queries
    • dat.Null* creators
    • fix resource cleanup
    • ๐ŸŒฒ fix duplicate error logging
    • ๐Ÿ“œ include RFC339Nano in NullTime parsing
    • HUGE BUG in remapPlaceholders
  • v1.0.0

    • ๐Ÿšš Original dat moved to legacy branch.

    • ๐Ÿšš Move to gopkg.in for API stability.

    • Legacy Connection renamed to DB to be consistent with database/sql

    • Connection is now the interface for DB and Tx. Use Connection to receive either a DB or Tx.

    • โœ… Support for nested transactions. Needs user testing and feedback.

      In a nested transaction only the top-most commit commits to the database if it has not been rollbacked. Any rollback in nested funtion results in entire transaction being rollbacked and leaves the transaction in tx.IsRollbacked() state.

    
        func nested(conn runner.Connection) error {
            tx, err := conn.Begin()
            if err != nil {
                return err
            }
            defer tx.AutoRollback()
    
            _, err := tx.SQL('...').Exec()
            if err != nil {
                return err
            }
            return tx.Commit()
        }
    
        func fromDB() error {
            return nested(DB)
        }
    
        func fromTx() error {
            tx, err := DB.Begin()
            if err != nil {
                return err
            }
            defer tx.AutoRollback()
    
            err := nested(tx)
            if err ! = nil {
                return logger.Error("Failed in nested", err)
            }
            // if Rollback was called, Commit returns an error
            return tx.Commit()
        }
    
    
    • SelectDoc.HasMany and SelectDoc.HasOne renamed to Many and One for retrieving hierarchical JSON documents. BTW, SelectDoc itself can be used in Many and One to build N-deep hierarchies.
    
        DB.SelectDoc("id", "user_name", "avatar").
            Many("recent_comments", `SELECT id, title FROM comments WHERE id = users.id LIMIT 10`).
            Many("recent_posts", `SELECT id, title FROM posts WHERE author_id = users.id LIMIT 10`).
            One("account", `SELECT balance FROM accounts WHERE user_id = users.id`).
            From("users").
            Where("id = $1", 4).
            QueryStruct(&obj) // obj must be agreeable with json.Unmarshal()
    
    
    • ๐Ÿ‘ Session obsoleted. Go's db library does not support transaction-less sessions. Use Tx if you need a session, otherwise use DB directly.

    • ๐Ÿ›  Fixes to dat.NullTime to properly work with JSON timestamps from HTTP handlers and timestamptz.