type DataAccess struct { db string } func (d *DataAccess) createFactory(db string) Ifactory { if d == nil { return nil } var f Ifactory if db == "sqlserver" { f = new(SqlServerFactory) } else if db == "access" { f = new(AccessFactory) } return f }