gitlab.com/evatix-go/core@v1.3.55/cmd/main/infoCreateExample01.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"gitlab.com/evatix-go/core/coretaskinfo"
     7  	"gitlab.com/evatix-go/core/errcore"
     8  )
     9  
    10  func infoCreateExample01() {
    11  	info := coretaskinfo.New.Info.Default(
    12  		"some name",
    13  		"some desc",
    14  		"some url")
    15  
    16  	fmt.Println(info.LazyMapPrettyJsonString())
    17  
    18  	infoExamples := coretaskinfo.New.Info.Examples(
    19  		"some name",
    20  		"some desc",
    21  		"some url",
    22  		"some examples1 \"some command\"", "some examples 2")
    23  
    24  	fmt.Println(infoExamples.LazyMapPrettyJsonString())
    25  
    26  	infoNoExamples := coretaskinfo.New.Info.Examples(
    27  		"no exmaple some name",
    28  		"some desc",
    29  		"some url",
    30  	)
    31  
    32  	fmt.Println(infoNoExamples.LazyMapPrettyJsonString())
    33  
    34  	infoNoExamples2, parseErr := coretaskinfo.New.Info.Deserialized(
    35  		infoNoExamples.JsonPtr().Bytes)
    36  
    37  	errcore.HandleErr(parseErr)
    38  	fmt.Println(infoNoExamples2.PrettyJsonStringWithPayloads([]byte("some payloads2")))
    39  
    40  	infoNoExamples2 = nil
    41  
    42  	fmt.Println(infoNoExamples2.PrettyJsonStringWithPayloads([]byte("some payloads3")))
    43  }