func CheckKeys(keys []string, data map[string]interface{}) error {
	for k := range keys {
		if _, ok := data[keys[k]]; !ok {
			return fmt.Errorf("%q doesn't exist", keys[k])
		}
	}
	return nil
}
CheckKeys checks if keys exist
package apis
import (
	"fmt"
	log "github.com/Sirupsen/logrus"
	"github.com/hashicorp/golang-lru"
	"github.com/intuit/katlas/service/db"
	"github.com/intuit/katlas/service/util"
	"github.com/mitchellh/mapstructure"
	"strings"
)
type IMetaService interface {
	GetMetadata(name string) (*Metadata, error)
	CreateMetadata(data Metadata) (string, error)
	DeleteMetadata(name string) error
	UpdateMetadata(name string, data map[string]interface{}) error
	GetMetadataFields(name string) ([]MetadataField, error)
	CreateSchema(sm db.Schema) error
	DropSchema(name string) error
	RemoveSchemaCache(cache *lru.Cache)
}
type MetaService struct {
	dbclient db.IDGClient
}
type Metadata struct {
	UID             string          `json:"uid"`
	Name            string          `json:"name"`
	ObjType         string          `json:"objtype,omitempty"`
	Fields          []MetadataField `json:"fields,omitempty"`
	ResourceVersion string          `json:"resourceversion,omitempty"`
}
type MetadataField struct {
	UID       string `json:"uid"`
	FieldName string `json:"fieldname"`
	FieldType string `json:"fieldtype"`
	Mandatory bool `json:"mandatory"`
	RefDataType string `json:"refdatatype,omitempty"`
	Cardinality string `json:"cardinality,omitempty"`
}
func (s MetaService) GetMetadata(name string) (*Metadata, error) {
	qm := map[string][]string{util.Name: {name}, util.ObjType: {util.Metadata}}
	queryService := NewQueryService(s.dbclient)
	metas, err := queryService.GetQueryResult(qm)
	if err != nil {
		return nil, err
	}
	if len(metas[util.Objects].([]interface{})) > 0 {
		meta := metas[util.Objects].([]interface{})[0].(map[string]interface{})
		var metadata Metadata
		err = mapstructure.Decode(meta, &metadata)
		if err != nil {
			return nil, err
		}
		return &metadata, nil
	}
	return nil, nil
}
func NewMetaService(dc db.IDGClient) *MetaService {
	return &MetaService{dc}
}
func (s MetaService) GetMetadataFields(name string) ([]MetadataField, error) {
	qm := map[string][]string{util.Name: {name}, util.ObjType: {util.Metadata}}
	queryService := NewQueryService(s.dbclient)
	metas, err := queryService.GetQueryResult(qm)
	if err != nil {
		return nil, err
	}
	if len(metas[util.Objects].([]interface{})) > 0 {
		meta := metas[util.Objects].([]interface{})[0].(map[string]interface{})
		var metadata Metadata
		err = mapstructure.Decode(meta, &metadata)
		if err != nil {
			return nil, err
		}
		return metadata.Fields, nil
	}
	return nil, nil
}