meta.go 446 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
package main

import "fmt"

type Meta struct {
	Servers []CubeServer `json:"servers,omitempty"`
}

func (meta *Meta) Seek(dict_name string, input string, output string) (err error) {
	var server CubeServer

	for _, s := range meta.Servers {
		if s.Name == dict_name {
			server = s
			break
		}
	}
	if server.Name != dict_name {
		err = fmt.Errorf("%s server not exist", dict_name)
		return err
	}
	err = server.Seek(input, output)
	return err
}