You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: orm_engine.go
    path of file: ./repos/erda/internal/tools/orchestrator/hepa/repository/orm
    
    the code of the file until where you have to start completion: // Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "Lice
    
func NewOrmEngine(driver string, sources []string, options map[string]string) (*OrmEngine, error) {
	if len(sources) == 0 {
		return nil, errors.New("empty source")
	}
	log := &SqlLog
	if len(sources) == 1 {
		innerEngine, err := xorm.NewEngine(driver, sources[0])
		if err != nil {
			return nil, errors.Wrap(err, "xorm NewEngine failed")
		}
		innerEngine.SetLogger(log)
		innerEngine.ShowSQL(true)
		return &OrmEngine{OrmEngineInterface: innerEngine, mode: SingleMode}, nil
	} else {
		optionPolicy := options["policy"]
		var policy xorm.GroupPolicy
		switch optionPolicy {
		case "round_robin":
			policy = xorm.RoundRobinPolicy()
		case "least_conn":
			policy = xorm.LeastConnPolicy()
		case "random":
		default:
			policy = xorm.RandomPolicy()
		}
		innerGroup, err := xorm.NewEngineGroup(driver, sources, policy)
		if err != nil {
			return nil, errors.Wrap(err, "xorm NewEngineGroup failed")
		}
		innerGroup.SetLogger(log)
		innerGroup.ShowSQL(true)
		return &OrmEngine{OrmEngineInterface: innerGroup, mode: ClusterMode}, nil
	}
}