Warning: Undefined array key "rss_show_deleted" in /var/www/wiki/dw/inc/Feed/FeedCreatorOptions.php on line 86

Warning: Cannot modify header information - headers already sent by (output started at /var/www/wiki/dw/inc/Feed/FeedCreatorOptions.php:86) in /var/www/wiki/dw/feed.php on line 53

Warning: Cannot modify header information - headers already sent by (output started at /var/www/wiki/dw/inc/Feed/FeedCreatorOptions.php:86) in /var/www/wiki/dw/feed.php on line 54

Warning: Cannot modify header information - headers already sent by (output started at /var/www/wiki/dw/inc/Feed/FeedCreatorOptions.php:86) in /var/www/wiki/dw/feed.php on line 55

Warning: Cannot modify header information - headers already sent by (output started at /var/www/wiki/dw/inc/Feed/FeedCreatorOptions.php:86) in /var/www/wiki/dw/feed.php on line 56

Warning: Cannot modify header information - headers already sent by (output started at /var/www/wiki/dw/inc/Feed/FeedCreatorOptions.php:86) in /var/www/wiki/dw/inc/httputils.php on line 32

Warning: Cannot modify header information - headers already sent by (output started at /var/www/wiki/dw/inc/Feed/FeedCreatorOptions.php:86) in /var/www/wiki/dw/inc/httputils.php on line 33
wiki.unix7.org - go http://wiki.unix7.org/ Tue, 04 Aug 2026 00:31:22 +0000 FeedCreator 1.8 http://wiki.unix7.org/lib/tpl/unix7/images/favicon.ico wiki.unix7.org http://wiki.unix7.org/ Generic Go database class http://wiki.unix7.org/go/gendb Generic Go database class package main import ( "encoding/json" "fmt" ) type Results interface { Task[Cluster] | Task[Flomaster] } type Database[T Results] struct { store map[int64][]byte } func (db *Database[T]) Write(id int64, obj T) { jBytes, _ := json.Marshal(obj) db.store[id] = jBytes } func (db *Database[T]) Read(id int64) T { var res T _ = json.Unmarshal(db.store[id], &res) return res } func NewDatabase[T Results]() *Database[T] { return &Database[T]{ store: make(map… anonymous@undisclosed.example.com (Anonymous) Fri, 10 Mar 2023 15:01:02 +0000 Response http://wiki.unix7.org/go/response Response package main import ( "encoding/json" "errors" "fmt" ) type Response struct { Error bool `json:"error"` // ErrorCode int64 `json:"errorCode"` Result interface{} `json:"result,omitempty"` Message string `json:"message,omitempty"` } func SendErrorResponse(err error) { var response Response response.Error = true if (err != nil) { response.Message = err.Error() } jsonBin, _ := json.MarshalIndent(response, "", "… anonymous@undisclosed.example.com (Anonymous) Fri, 27 Jan 2023 06:43:31 +0000 Unlimited сhannel on Unix semaphores http://wiki.unix7.org/go/semchannel go c Unlimited сhannel on Unix semaphores Golang variant of “Thread pool with unlimited channel”. Пример рабочий, но с ограниченным использованием, из-за издержек CGO. Возможно, при необходимости использования семафоров целесообразнее anonymous@undisclosed.example.com (Anonymous) Mon, 09 Jan 2023 10:03:55 +0000