You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "ImSingee (via GitHub)" <gi...@apache.org> on 2023/06/19 14:01:36 UTC

[GitHub] [incubator-opendal] ImSingee commented on pull request #2488: feat: Add golang binding for OpenDAL

ImSingee commented on PR #2488:
URL: https://github.com/apache/incubator-opendal/pull/2488#issuecomment-1597247257

   I think we can provide an interface instead of the struct.
   
   This also provides an extra benefit: we can return a (maybe auto-generated) type which always return an error.
   
   
   ```go
   type Operator interface {
       DoSomething() error
   }
   
   type errOperator struct {}
   
   func (o errOperator) DoSomething() error {
     return fmt.Errorf("not supported")
   }
   
   func NewOperator() Operator {
      if opendal not exist {
          return errOperator{}
      }
   
      return ...
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org