aaaaaaaaaa just try ææ
This commit is contained in:
		
							
								
								
									
										14
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								main.go
									
									
									
									
									
								
							@@ -1,16 +1,10 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"gotest/FizzBuzz"
 | 
			
		||||
	"gotest/consecutive"
 | 
			
		||||
)
 | 
			
		||||
import "gotest/solutions"
 | 
			
		||||
 | 
			
		||||
var URL = "https://kuvaev-ituniversity.vps.elewise.com/tasks/Чудные вхождения в массив"
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	solutions.NewService().MakeGet(URL)
 | 
			
		||||
 | 
			
		||||
	array := []int{1, 2, 4, 3, 6, 5}
 | 
			
		||||
 | 
			
		||||
	fmt.Println("consecutive", consecutive.Consecutive(array))
 | 
			
		||||
 | 
			
		||||
	FizzBuzz.Fizzbuzz()
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										41
									
								
								solutions/getTask.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								solutions/getTask.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,41 @@
 | 
			
		||||
package solutions
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"io"
 | 
			
		||||
	"log"
 | 
			
		||||
	"net/http"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func NewService() taskService {
 | 
			
		||||
	return taskService{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type taskService struct {
 | 
			
		||||
	store solutionResult
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (t taskService) MakeGet(url string) {
 | 
			
		||||
	res, err := http.Get(url)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
	body, err := io.ReadAll(res.Body)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
	res.Body.Close()
 | 
			
		||||
 | 
			
		||||
	//b, _ := asn1.MarshalWithParams()
 | 
			
		||||
	//t.store.Add(Payload(b))
 | 
			
		||||
	//
 | 
			
		||||
	//fmt.Println(b)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//func FindUnique() {
 | 
			
		||||
//	fmt.Println()
 | 
			
		||||
//
 | 
			
		||||
//	//for i, _ := range c {
 | 
			
		||||
//	//	fmt.Println(i)
 | 
			
		||||
//	//}
 | 
			
		||||
//
 | 
			
		||||
//}
 | 
			
		||||
							
								
								
									
										20
									
								
								solutions/model.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								solutions/model.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
package solutions
 | 
			
		||||
 | 
			
		||||
type UserName string
 | 
			
		||||
 | 
			
		||||
type TaskName string
 | 
			
		||||
 | 
			
		||||
type Result int
 | 
			
		||||
 | 
			
		||||
type Payload string
 | 
			
		||||
 | 
			
		||||
type solutionResult struct {
 | 
			
		||||
	Payload []Payload `json:"payload"`
 | 
			
		||||
	Results []Result  `json:"results"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type Solution struct {
 | 
			
		||||
	UserName UserName       `json:"user_name"`
 | 
			
		||||
	TaskName TaskName       `json:"task_name"`
 | 
			
		||||
	Results  solutionResult `json:"results"`
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										9
									
								
								solutions/store.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								solutions/store.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
package solutions
 | 
			
		||||
 | 
			
		||||
func NewPayloadStore() solutionResult {
 | 
			
		||||
	return solutionResult{Payload: []Payload{}}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *solutionResult) Add(payload Payload) {
 | 
			
		||||
	c.Payload = append(c.Payload, payload)
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +0,0 @@
 | 
			
		||||
package solutions
 | 
			
		||||
 | 
			
		||||
type Task struct {
 | 
			
		||||
}
 | 
			
		||||
@@ -1 +0,0 @@
 | 
			
		||||
package solutions
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user