code: func compareHost(x, y string) int {
  	// The more-specific, the smaller it is.
  	// The pattern '%' means “any host” and is least specific.
  	if y == `%` {
  		if x == `%` {
  			return 0
  		}
  		return -1
  	}
  
  	// The empty string '' also means “any host” but sorts after '%'.
  	if y == "" {
  		if x == "" {
  			return 0
  		}
  		return -1
  	}
  
  	// One of them end with `%`.
  	xEnd := strings.HasSuffix(x, `%`)
  	yEnd := strings.HasSuffix(y, `%`)
  	if xEnd || yEnd {
  		switch {
  		case !xEnd && yEnd:
  			return -1
  		case xEnd && !yEnd:
  			return 1
  		case xEnd && yEnd:
  			// 192.168.199.% smaller than 192.168.%
  			// A not very accurate comparison, compare them by length.
  			if len(x) > len(y) {
  				return -1
  			}
  		}
  		return 0
  	}
  
  	// For other case, the order is nondeterministic.
  	switch x < y {
  	case true:
  		return -1
  	case false:
  		return 1
  	}
  	return 0
  }
docs: // compareHost compares two host string using some special rules, return value 1, 0, -1 means > = <.
  // TODO: Check how MySQL do it exactly, instead of guess its rules.