func (db *Redis) CreateLink(link *models.Link) error {

	encodedLink, err := json.Marshal(link)
	if err != nil {
		return err
	}

	set, err := db.store.SetNX(link.ID, encodedLink, 0).Result()
	if !set {
		return tkerrors.ErrEntityExists
	}
	if err != nil {
		return err
	}
	return nil
}
// CreateLink stores a new link into database
CreateLink stores a new link into database
// CreateLink stores a new link into database
func (db *Redis) CreateLink(link *models.Link) error {
	encodedLink, err := json.Marshal(link)
	if err != nil {
		return err
	}
	set, err := db.store.SetNX(link.ID, encodedLink, 0).Result()
	if !set {
		return tkerrors.ErrEntityExists
	}
	if err != nil {
		return err
	}
	return nil
}
func ( db * Redis ) CreateLink ( link * models . Link ) error { encodedLink , err := json . Marshal ( link ) if err != nil { return err } set , err := db . store . SetNX ( link . ID , encodedLink , 0 ) . Result ( ) if ! set { return tkerrors . ErrEntityExists } if err != nil { return err } return nil }
CreateLink stores a new link into database
CreateLink stores a new link into database