Skip to content

Instantly share code, notes, and snippets.

View mikelpsv's full-sized avatar
😇
Working from home

Mike mikelpsv

😇
Working from home
  • Russia
View GitHub Profile
@mikelpsv
mikelpsv / left-bar.vue
Created February 26, 2026 04:14 — forked from languanghao/left-bar.vue
element ui menu with vue-router
<template>
<el-menu :router="true" :default-active="activeLink">
<template v-for="rule in $router.options.routes">
<el-submenu v-if="rule.children && rule.children.length > 0"
:index="rule.path"
>
<template slot="title"><i :class="rule.icon"></i>{{ rule.title }}</template>
<el-menu-item v-for="child in rule.children" :index="rule.path + '/' + child.path">{{ child.title }}</el-menu-item>
</el-submenu>
<el-menu-item v-else
@mikelpsv
mikelpsv / nullHandle.go
Created September 5, 2024 15:29 — forked from rsudip90/nullHandle.go
How I handled the null possible value in a sql database row in golang?
package main
import (
"database/sql"
"encoding/json"
"fmt"
"reflect"
"time"
"github.com/go-sql-driver/mysql"
master=> SELECT * FROM (VALUES (1, true), (2, false), (3, null)) AS t (id,value);
id | value
----+-------
1 | t
2 | f
3 |
(3 rows)
master=> SELECT * FROM (VALUES (1, true), (2, false), (3, null)) AS t (id,value) order by value;
id | value
func TestFasthttpServer(t *testing.T) {
fSv := fasthttp.Server{}
fSv.Handler = func(ctx *fasthttp.RequestCtx) {
if string(ctx.Path()) == "/test" && string(ctx.Method()) == "GET" {
ctx.WriteString("OK")
}
}
ln := fasthttputil.NewInmemoryListener()
// https://github.com/valyala/fasthttp/issues/36
//
// serve serves http request using provided fasthttp handler
func serve(handler fasthttp.RequestHandler, req *http.Request) (*http.Response, error) {
ln := fasthttputil.NewInmemoryListener()
defer ln.Close()
go func() {
err := fasthttp.Serve(ln, handler)
if err != nil {