镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Add typed API to pkg/attribute - #2486

Merged
wangkuiyi merged 1 commit into
sql-machine-learning:developfrom
wangkuiyi:attribute_api
Jun 18, 2020
Merged

wangkuiyi merged 1 commit into
sql-machine-learning:developfrom
wangkuiyi:attribute_api

Conversation

@wangkuiyi

Copy link
Copy Markdown
Collaborator

@tonyyang-svail tonyyang-svail left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Type: Int,
Default: value,
Doc: doc,
Checker: func(x interface{}) error { return checker(x.(int)) },

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I should make it

func(x interface{}) error {
    v, ok := x(int)
    if ! ok {
         return fmt.Errorf("Attribute %s is of type int, but the value %v cannot be casted into int", name, x)
    }
    return checker(v)
}

@wangkuiyi
wangkuiyi merged commit c33552b into sql-machine-learning:develop Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants