func init() { pop.Debug = false pop.AddLookupPaths("./") dialect := os.Getenv("SODA_DIALECT") var err error PDB, err = pop.Connect(dialect) if err != nil { log.Panic(err) } pop.MapTableName("Friend", "good_friends") pop.MapTableName("Friends", "good_friends") }
func Test_MapTableName(t *testing.T) { r := require.New(t) pop.MapTableName("Friend", "good_friends") m := pop.Model{Value: Friend{}} r.Equal(m.TableName(), "good_friends") m = pop.Model{Value: &Friend{}} r.Equal(m.TableName(), "good_friends") m = pop.Model{Value: &Friends{}} r.Equal(m.TableName(), "good_friends") m = pop.Model{Value: []Friend{}} r.Equal(m.TableName(), "good_friends") m = pop.Model{Value: &[]Friend{}} r.Equal(m.TableName(), "good_friends") }