new model for links
This commit is contained in:
		
							
								
								
									
										26
									
								
								models/links.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								models/links.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
package models
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"reflect"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Link struct {
 | 
			
		||||
	source 			string
 | 
			
		||||
	destination 	string
 | 
			
		||||
	dcLink			bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewLink(src interface{}, dst interface{}) (link Link) {
 | 
			
		||||
	// Check type with reflect and get ID 
 | 
			
		||||
	typeSrc := reflect.TypeOf(src)
 | 
			
		||||
	typeDst := reflect.TypeOf(dst)
 | 
			
		||||
 | 
			
		||||
	fmt.Println("src is %s\ndst is %s",typeSrc,typeDst)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (l *Link) AddLinkToDataCenter(component interface{}) {
 | 
			
		||||
	// if the component has a DataCenter id attribute then add it (switch on type)
 | 
			
		||||
} 
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user