fix(aof): fix aof is nil

This commit is contained in:
bandl 2021-11-02 13:02:02 +08:00
parent de59f13234
commit 1ca43cde6c
2 changed files with 69 additions and 23 deletions

View File

@ -19,7 +19,9 @@ func (s *singleService) LIndex(
if err != nil {
return nil, err
}
s.aof.SendRequest("LIndex", req)
if s.aof != nil {
s.aof.SendRequest("LIndex", req)
}
return resp, nil
})
@ -45,7 +47,9 @@ func (s *singleService) LLen(
if err != nil {
return nil, err
}
s.aof.SendRequest("LLen", req)
if s.aof != nil {
s.aof.SendRequest("LLen", req)
}
return resp, nil
})
@ -71,7 +75,9 @@ func (s *singleService) LPop(
if err != nil {
return nil, err
}
s.aof.SendRequest("LPop", req)
if s.aof != nil {
s.aof.SendRequest("LPop", req)
}
return resp, nil
})
@ -97,7 +103,9 @@ func (s *singleService) LPush(
if err != nil {
return nil, err
}
s.aof.SendRequest("LPush", req)
if s.aof != nil {
s.aof.SendRequest("LPush", req)
}
return resp, nil
})
@ -123,7 +131,9 @@ func (s *singleService) LPushX(
if err != nil {
return nil, err
}
s.aof.SendRequest("LPushX", req)
if s.aof != nil {
s.aof.SendRequest("LPushX", req)
}
return resp, nil
})
@ -149,7 +159,9 @@ func (s *singleService) LRange(
if err != nil {
return nil, err
}
s.aof.SendRequest("LRange", req)
if s.aof != nil {
s.aof.SendRequest("LRange", req)
}
return resp, nil
})
@ -175,7 +187,9 @@ func (s *singleService) LRem(
if err != nil {
return nil, err
}
s.aof.SendRequest("LRem", req)
if s.aof != nil {
s.aof.SendRequest("LRem", req)
}
return resp, nil
})
@ -201,7 +215,9 @@ func (s *singleService) LSet(
if err != nil {
return nil, err
}
s.aof.SendRequest("LSet", req)
if s.aof != nil {
s.aof.SendRequest("LSet", req)
}
return resp, nil
})
@ -227,7 +243,9 @@ func (s *singleService) RPop(
if err != nil {
return nil, err
}
s.aof.SendRequest("RPop", req)
if s.aof != nil {
s.aof.SendRequest("RPop", req)
}
return resp, nil
})
@ -253,7 +271,9 @@ func (s *singleService) LTrim(
if err != nil {
return nil, err
}
s.aof.SendRequest("LTrim", req)
if s.aof != nil {
s.aof.SendRequest("LTrim", req)
}
return resp, nil
})
@ -279,7 +299,9 @@ func (s *singleService) RPush(
if err != nil {
return nil, err
}
s.aof.SendRequest("RPush", req)
if s.aof != nil {
s.aof.SendRequest("RPush", req)
}
return resp, nil
})
@ -305,7 +327,9 @@ func (s *singleService) RPushX(
if err != nil {
return nil, err
}
s.aof.SendRequest("RPushX", req)
if s.aof != nil {
s.aof.SendRequest("RPushX", req)
}
return resp, nil
})
@ -331,7 +355,9 @@ func (s *singleService) Set(
if err != nil {
return nil, err
}
s.aof.SendRequest("Set", req)
if s.aof != nil {
s.aof.SendRequest("Set", req)
}
return resp, nil
})
@ -357,7 +383,9 @@ func (s *singleService) Get(
if err != nil {
return nil, err
}
s.aof.SendRequest("Get", req)
if s.aof != nil {
s.aof.SendRequest("Get", req)
}
return resp, nil
})
@ -383,7 +411,9 @@ func (s *singleService) Add(
if err != nil {
return nil, err
}
s.aof.SendRequest("Add", req)
if s.aof != nil {
s.aof.SendRequest("Add", req)
}
return resp, nil
})
@ -409,7 +439,9 @@ func (s *singleService) Reduce(
if err != nil {
return nil, err
}
s.aof.SendRequest("Reduce", req)
if s.aof != nil {
s.aof.SendRequest("Reduce", req)
}
return resp, nil
})
@ -435,7 +467,9 @@ func (s *singleService) Setnx(
if err != nil {
return nil, err
}
s.aof.SendRequest("Setnx", req)
if s.aof != nil {
s.aof.SendRequest("Setnx", req)
}
return resp, nil
})
@ -461,7 +495,9 @@ func (s *singleService) SetBit(
if err != nil {
return nil, err
}
s.aof.SendRequest("SetBit", req)
if s.aof != nil {
s.aof.SendRequest("SetBit", req)
}
return resp, nil
})
@ -487,7 +523,9 @@ func (s *singleService) GetBit(
if err != nil {
return nil, err
}
s.aof.SendRequest("GetBit", req)
if s.aof != nil {
s.aof.SendRequest("GetBit", req)
}
return resp, nil
})
@ -513,7 +551,9 @@ func (s *singleService) GetRange(
if err != nil {
return nil, err
}
s.aof.SendRequest("GetRange", req)
if s.aof != nil {
s.aof.SendRequest("GetRange", req)
}
return resp, nil
})
@ -539,7 +579,9 @@ func (s *singleService) GetSet(
if err != nil {
return nil, err
}
s.aof.SendRequest("GetSet", req)
if s.aof != nil {
s.aof.SendRequest("GetSet", req)
}
return resp, nil
})
@ -565,7 +607,9 @@ func (s *singleService) StrLen(
if err != nil {
return nil, err
}
s.aof.SendRequest("StrLen", req)
if s.aof != nil {
s.aof.SendRequest("StrLen", req)
}
return resp, nil
})

View File

@ -20,7 +20,9 @@ func (s *singleService) {{key.method}}(
if err != nil{
return nil, err
}
s.aof.SendRequest("{{key.method}}", req)
if s.aof != nil {
s.aof.SendRequest("{{key.method}}", req)
}
return resp, nil
})