psqlInfo := fmt . Sprintf ( "host=%s port=%d user=%s " + "password=%s dbname=%s sslmode=disable" , host , port , user , password , dbname ) db , err := sqlx . Open ( "postgres" , psqlInfo ) // create a TX tx , err := db . BeginTxx ( context , & sql . TxOptions { Isolation : sql . LevelDefault }) rows , err := tx . Query ( `select amount from person where id=$1` , 1 ) .... Belows is some types of level in Golang support // IsolationLevel is the transaction isolation level used in TxOptions. type IsolationLevel int // Various isolation levels that drivers may support in BeginTx. // If a driver does not support a given isolation level an error may be returned. // // See https://en.wikipedia.org/wiki/Isolation_(database_systems)#Isolation_levels. const ( LevelDefault IsolationLevel = iota LevelReadUncommitted LevelReadCommitted LevelWriteCommitted LevelRepeatableRead LevelSnapshot LevelSerializable LevelLi...