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: memstore.go
    path of file: ./repos/iris/core/memstore
    
    the code of the file until where you have to start completion: // Package memstore contains a store which is just
// a collection of key-value entries with immutability capabilities.
//
/
    
func (e Entry) Uint8Default(def uint8) (uint8, error) {
	v := e.ValueRaw
	if v == nil {
		return def, e.notFound(uint8Type)
	}

	switch vv := v.(type) {
	case string:
		val, err := strconv.ParseUint(vv, 10, 8)
		if err != nil {
			return def, err
		}
		return uint8(val), nil
	case uint:
		if vv > math.MaxUint8 {
			return def, e.notFound(uint8Type)
		}
		return uint8(vv), nil
	case uint8:
		return vv, nil
	case uint16:
		if vv > math.MaxUint8 {
			return def, e.notFound(uint8Type)
		}
		return uint8(vv), nil
	case uint32:
		if vv > math.MaxUint8 {
			return def, e.notFound(uint8Type)
		}
		return uint8(vv), nil
	case uint64:
		if vv > math.MaxUint8 {
			return def, e.notFound(uint8Type)
		}
		return uint8(vv), nil
	case int:
		if vv < 0 || vv > math.MaxUint8 {
			return def, e.notFound(uint8Type)
		}
		return uint8(vv), nil
	}

	return def, e.notFound(uint8Type)
}