Skip to content
Snippets Groups Projects
Select Git revision
  • aa004776ad05048786e9b3173affd7f1e18f97eb
  • master default protected
  • url-repo-rename
  • jono/ui-fix
4 results

go.mod

Blame
  • This project manages its dependencies using Go Modules. Learn more
    bindings.go 1023 B
    ///////////////////////////////////////////////////////////////////////////////
    // Copyright © 2020 xx network SEZC                                          //
    //                                                                           //
    // Use of this source code is governed by a license that can be found in the //
    // LICENSE file                                                              //
    ///////////////////////////////////////////////////////////////////////////////
    
    package stoppable
    
    import "time"
    
    type Bindings interface {
    	Close(timeoutMS int) error
    	IsRunning() bool
    	Name() string
    }
    
    func WrapForBindings(s Stoppable) Bindings {
    	return &bindingsStoppable{s: s}
    }
    
    type bindingsStoppable struct {
    	s Stoppable
    }
    
    func (bs *bindingsStoppable) Close(timeoutMS int) error {
    	timeout := time.Duration(timeoutMS) * time.Millisecond
    	return bs.s.Close(timeout)
    }
    
    func (bs *bindingsStoppable) IsRunning() bool {
    	return bs.s.IsRunning()
    }
    
    func (bs *bindingsStoppable) Name() string {
    	return bs.s.Name()
    }