vendor dependencies with dep

This commit is contained in:
dhax 2017-09-25 20:20:52 +02:00
parent 93d8310491
commit 1384296a47
2712 changed files with 965742 additions and 0 deletions

39
vendor/github.com/go-pg/pg/orm/tables.go generated vendored Normal file
View file

@ -0,0 +1,39 @@
package orm
import (
"fmt"
"reflect"
"sync"
)
var Tables = newTables()
type tables struct {
mu sync.RWMutex
tables map[reflect.Type]*Table
}
func newTables() *tables {
return &tables{
tables: make(map[reflect.Type]*Table),
}
}
func (t *tables) Get(typ reflect.Type) *Table {
if typ.Kind() != reflect.Struct {
panic(fmt.Errorf("got %s, wanted %s", typ.Kind(), reflect.Struct))
}
t.mu.RLock()
table, ok := t.tables[typ]
t.mu.RUnlock()
if ok {
return table
}
t.mu.Lock()
table = newTable(typ)
t.mu.Unlock()
return table
}